64
64
public class RediscoveryTest
65
65
{
66
66
67
- private static ClusterCompositionResponse .Success Success ( ClusterComposition cluster )
67
+ private static ClusterCompositionResponse .Success success ( ClusterComposition cluster )
68
68
{
69
69
return new ClusterCompositionResponse .Success ( cluster );
70
70
}
71
71
72
- private static ClusterCompositionResponse .Failure Failure ( RuntimeException e )
72
+ private static ClusterCompositionResponse .Failure failure ( RuntimeException e )
73
73
{
74
74
return new ClusterCompositionResponse .Failure ( e );
75
75
}
@@ -87,7 +87,7 @@ public void shouldTryConfiguredMaxRoutingFailures() throws Exception
87
87
88
88
ClusterCompositionProvider mockedProvider = mock ( ClusterCompositionProvider .class );
89
89
when ( mockedProvider .getClusterComposition ( any ( Connection .class ) ) )
90
- .thenReturn ( Success ( INVALID_CLUSTER_COMPOSITION ) );
90
+ .thenReturn ( success ( INVALID_CLUSTER_COMPOSITION ) );
91
91
92
92
Rediscovery rediscovery = new Rediscovery ( settings , mock ( Clock .class ), DEV_NULL_LOGGER , mockedProvider );
93
93
@@ -124,7 +124,7 @@ public void shouldForgetRouterAndTryNextRouterWhenFailedToConnect() throws Throw
124
124
ClusterCompositionProvider
125
125
mockedProvider = mock ( ClusterCompositionProvider .class );
126
126
when ( mockedProvider .getClusterComposition ( healthyConn ) )
127
- .thenReturn ( Success ( ClusterCompositionUtil .VALID_CLUSTER_COMPOSITION ) );
127
+ .thenReturn ( success ( ClusterCompositionUtil .VALID_CLUSTER_COMPOSITION ) );
128
128
129
129
// When
130
130
ClusterComposition clusterComposition = rediscover ( mockedConnections , routingTable , mockedProvider );
@@ -152,7 +152,7 @@ public void shouldThrowServiceUnavailableWhenNoProcedureFound() throws Throwable
152
152
ClusterCompositionProvider
153
153
mockedProvider = mock ( ClusterCompositionProvider .class );
154
154
when ( mockedProvider .getClusterComposition ( healthyConn ) )
155
- .thenReturn ( Failure ( new ServiceUnavailableException ( "No such procedure" ) ) );
155
+ .thenReturn ( failure ( new ServiceUnavailableException ( "No such procedure" ) ) );
156
156
157
157
// When & When
158
158
try
@@ -203,9 +203,9 @@ public void shouldTryNextRouterWhenNoWriters() throws Throwable
203
203
204
204
ClusterCompositionProvider
205
205
mockedProvider = mock ( ClusterCompositionProvider .class );
206
- when ( mockedProvider .getClusterComposition ( noWriterConn ) ).thenReturn ( Success ( noWriters ) );
206
+ when ( mockedProvider .getClusterComposition ( noWriterConn ) ).thenReturn ( success ( noWriters ) );
207
207
when ( mockedProvider .getClusterComposition ( healthyConn ) )
208
- .thenReturn ( Success ( ClusterCompositionUtil .VALID_CLUSTER_COMPOSITION ) );
208
+ .thenReturn ( success ( ClusterCompositionUtil .VALID_CLUSTER_COMPOSITION ) );
209
209
210
210
// When
211
211
ClusterComposition clusterComposition = rediscover ( mockedConnections , routingTable , mockedProvider );
@@ -226,7 +226,7 @@ public void shouldThrowServiceUnavailableWhenNoNextRouter() throws Throwable
226
226
227
227
ClusterCompositionProvider
228
228
mockedProvider = mock ( ClusterCompositionProvider .class );
229
- when ( mockedProvider .getClusterComposition ( noWriterConn ) ).thenReturn ( Success ( noWriters ) );
229
+ when ( mockedProvider .getClusterComposition ( noWriterConn ) ).thenReturn ( success ( noWriters ) );
230
230
231
231
// When & THen
232
232
try
@@ -278,7 +278,7 @@ public void shouldUpdateRoutingTableWithTheNewOne() throws Throwable
278
278
279
279
ClusterCompositionProvider
280
280
mockedProvider = mock ( ClusterCompositionProvider .class );
281
- when ( mockedProvider .getClusterComposition ( healthyConn ) ).thenReturn ( Success ( atLeastOneOfEach ) );
281
+ when ( mockedProvider .getClusterComposition ( healthyConn ) ).thenReturn ( success ( atLeastOneOfEach ) );
282
282
283
283
// When
284
284
ClusterComposition clusterComposition = rediscover ( mockedConnections , routingTable , mockedProvider );
@@ -303,7 +303,7 @@ public void shouldProtocolErrorWhenFailedToPaseClusterCompositin() throws Throwa
303
303
304
304
ClusterCompositionProvider mockedProvider = mock ( ClusterCompositionProvider .class );
305
305
ProtocolException exception = new ProtocolException ( "Failed to parse result" );
306
- when ( mockedProvider .getClusterComposition ( healthyConn ) ).thenReturn ( Failure ( exception ) );
306
+ when ( mockedProvider .getClusterComposition ( healthyConn ) ).thenReturn ( failure ( exception ) );
307
307
308
308
// When & When
309
309
try
0 commit comments