-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move assertions to test class and minor changes.
- Loading branch information
jzuriaga
committed
Sep 30, 2020
1 parent
b33b286
commit 7715e92
Showing
3 changed files
with
11 additions
and
17 deletions.
There are no files selected for viewing
16 changes: 4 additions & 12 deletions
16
...sions/mongodb-client/deployment/src/test/java/io/quarkus/mongodb/MockCommandListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,18 @@ | ||
package io.quarkus.mongodb; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.anyOf; | ||
import static org.hamcrest.Matchers.equalTo; | ||
import static org.hamcrest.Matchers.notNullValue; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import com.mongodb.event.CommandListener; | ||
import com.mongodb.event.CommandStartedEvent; | ||
|
||
public class MockCommandListener implements CommandListener { | ||
|
||
private CommandStartedEvent commandStartedEvent; | ||
public static final List<String> events = new ArrayList<>(); | ||
|
||
@Override | ||
public void commandStarted(CommandStartedEvent startedEvent) { | ||
this.commandStartedEvent = startedEvent; | ||
assertThat(startedEvent, notNullValue()); | ||
assertThat(startedEvent.getCommandName(), anyOf(equalTo("listDatabases"), equalTo("endSessions"))); | ||
} | ||
|
||
public CommandStartedEvent getCommandStartedEvent() { | ||
return commandStartedEvent; | ||
events.add(startedEvent.getCommandName()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters