4343import java .util .concurrent .locks .Lock ;
4444import java .util .concurrent .locks .ReentrantLock ;
4545
46+ import static com .mongodb .ClusterFixture .TIMEOUT ;
4647import static java .util .Collections .emptyList ;
4748import static org .junit .Assert .assertEquals ;
4849import static org .junit .Assert .assertNull ;
@@ -130,7 +131,7 @@ public List<CommandEvent> getCommandStartedEvents() {
130131 private List <CommandEvent > getCommandStartedEvents (final int maxEvents ) {
131132 lock .lock ();
132133 try {
133- List <CommandEvent > commandStartedEvents = new ArrayList <CommandEvent >();
134+ List <CommandEvent > commandStartedEvents = new ArrayList <>();
134135 for (CommandEvent cur : getEvents ()) {
135136 if (cur instanceof CommandStartedEvent ) {
136137 commandStartedEvents .add (cur );
@@ -150,7 +151,7 @@ public List<CommandEvent> waitForStartedEvents(final int numEvents) {
150151 try {
151152 while (!hasCompletedEvents (numEvents )) {
152153 try {
153- if (!commandCompletedCondition .await (10 , TimeUnit .SECONDS )) {
154+ if (!commandCompletedCondition .await (TIMEOUT , TimeUnit .SECONDS )) {
154155 throw new MongoTimeoutException ("Timeout waiting for event" );
155156 }
156157 } catch (InterruptedException e ) {
@@ -168,7 +169,7 @@ public void waitForFirstCommandCompletion() {
168169 try {
169170 while (!hasCompletedEvents (1 )) {
170171 try {
171- if (!commandCompletedCondition .await (10 , TimeUnit .SECONDS )) {
172+ if (!commandCompletedCondition .await (TIMEOUT , TimeUnit .SECONDS )) {
172173 throw new MongoTimeoutException ("Timeout waiting for event" );
173174 }
174175 } catch (InterruptedException e ) {
0 commit comments