@@ -33,7 +33,8 @@ import org.bson.BsonNull
3333import org.bson.BsonString
3434import spock.lang.Specification
3535
36- import static com.mongodb.ClusterFixture.*
36+ import static com.mongodb.ClusterFixture.TIMEOUT_SETTINGS
37+ import static com.mongodb.ClusterFixture.TIMEOUT_SETTINGS_WITH_INFINITE_TIMEOUT
3738import static com.mongodb.internal.connection.ProtocolHelper.getCommandFailureException
3839import static com.mongodb.internal.connection.ProtocolHelper.getQueryFailureException
3940import static com.mongodb.internal.connection.ProtocolHelper.isCommandOk
@@ -73,22 +74,19 @@ class ProtocolHelperSpecification extends Specification {
7374 def ' command failure exception should be MongoExecutionTimeoutException if error code is 50' () {
7475 expect :
7576 getCommandFailureException(new BsonDocument (' ok' , new BsonInt32 (0 )). append(' code' , new BsonInt32 (50 )),
76- new ServerAddress (), new TimeoutContext (TIMEOUT_SETTINGS ))
77- instanceof MongoExecutionTimeoutException
77+ new ServerAddress (), new TimeoutContext (TIMEOUT_SETTINGS )) instanceof MongoExecutionTimeoutException
7878 }
7979
8080 def ' command failure exception should be MongoOperationTimeoutException if error code is 50 and timeoutMS is set' () {
8181 expect :
8282 getCommandFailureException(new BsonDocument (' ok' , new BsonInt32 (0 )). append(' code' , new BsonInt32 (50 )),
83- new ServerAddress (), new TimeoutContext (TIMEOUT_SETTINGS_WITH_INFINITE_TIMEOUT ))
84- instanceof MongoOperationTimeoutException
83+ new ServerAddress (), new TimeoutContext (TIMEOUT_SETTINGS_WITH_INFINITE_TIMEOUT )) instanceof MongoOperationTimeoutException
8584 }
8685
8786 def ' query failure exception should be MongoExecutionTimeoutException if error code is 50' () {
8887 expect :
8988 getQueryFailureException(new BsonDocument (' code' , new BsonInt32 (50 )),
90- new ServerAddress (), new TimeoutContext (TIMEOUT_SETTINGS ))
91- instanceof MongoExecutionTimeoutException
89+ new ServerAddress (), new TimeoutContext (TIMEOUT_SETTINGS )) instanceof MongoExecutionTimeoutException
9290 }
9391
9492 def ' query failure exception should be MongoOperationTimeoutException if error code is 50' () {
@@ -97,13 +95,12 @@ class ProtocolHelperSpecification extends Specification {
9795 new ServerAddress (), new TimeoutContext (TIMEOUT_SETTINGS_WITH_INFINITE_TIMEOUT ))
9896 exception instanceof MongoOperationTimeoutException
9997 exception. getCause() instanceof MongoExecutionTimeoutException
100-
10198 }
10299
103100 def ' command failure exceptions should handle MongoNotPrimaryException scenarios' () {
104101 expect :
105- getCommandFailureException(exception, new ServerAddress (), new TimeoutContext ( TIMEOUT_SETTINGS ))
106- instanceof MongoNotPrimaryException
102+ getCommandFailureException(
103+ exception, new ServerAddress (), new TimeoutContext ( TIMEOUT_SETTINGS )) instanceof MongoNotPrimaryException
107104
108105 where :
109106 exception << [
@@ -115,8 +112,8 @@ class ProtocolHelperSpecification extends Specification {
115112
116113 def ' query failure exceptions should handle MongoNotPrimaryException scenarios' () {
117114 expect :
118- getQueryFailureException(exception, new ServerAddress (), new TimeoutContext ( TIMEOUT_SETTINGS ))
119- instanceof MongoNotPrimaryException
115+ getQueryFailureException(
116+ exception, new ServerAddress (), new TimeoutContext ( TIMEOUT_SETTINGS )) instanceof MongoNotPrimaryException
120117
121118 where :
122119 exception << [
@@ -128,8 +125,8 @@ class ProtocolHelperSpecification extends Specification {
128125
129126 def ' command failure exceptions should handle MongoNodeIsRecoveringException scenarios' () {
130127 expect :
131- getCommandFailureException(exception, new ServerAddress (), new TimeoutContext ( TIMEOUT_SETTINGS ))
132- instanceof MongoNodeIsRecoveringException
128+ getCommandFailureException(
129+ exception, new ServerAddress (), new TimeoutContext ( TIMEOUT_SETTINGS )) instanceof MongoNodeIsRecoveringException
133130
134131 where :
135132 exception << [
@@ -144,8 +141,8 @@ class ProtocolHelperSpecification extends Specification {
144141
145142 def ' query failure exceptions should handle MongoNodeIsRecoveringException scenarios' () {
146143 expect :
147- getQueryFailureException(exception, new ServerAddress (), new TimeoutContext ( TIMEOUT_SETTINGS ))
148- instanceof MongoNodeIsRecoveringException
144+ getQueryFailureException(
145+ exception, new ServerAddress (), new TimeoutContext ( TIMEOUT_SETTINGS )) instanceof MongoNodeIsRecoveringException
149146
150147 where :
151148 exception << [
0 commit comments