Skip to content

Commit

Permalink
fix mocks in broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ndimiduk committed Mar 14, 2023
1 parent 9847b38 commit 37591b1
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,9 @@ public static RpcRetryingCallerFactory instantiate(Configuration configuration,
if (rpcCallerFactoryClazz.equals(clazzName)) {
factory = new RpcRetryingCallerFactory(configuration, connectionConf, interceptor, metrics);
} else {
try {
factory = ReflectionUtils.instantiateWithCustomCtor(rpcCallerFactoryClazz,
new Class[] { Configuration.class }, new Object[] { configuration, connectionConf });
} catch (UnsupportedOperationException e) {
factory = ReflectionUtils.instantiateWithCustomCtor(rpcCallerFactoryClazz,
new Class[] { Configuration.class }, new Object[] { configuration });
}
factory = ReflectionUtils.instantiateWithCustomCtor(rpcCallerFactoryClazz,
new Class[] { Configuration.class, ConnectionConfiguration.class },
new Object[] { configuration, connectionConf });
}
return factory;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public void setup() throws IOException {
conf = new Configuration();
connectionConfig = new ConnectionConfiguration(conf);
Mockito.when(clusterConn.getConfiguration()).thenReturn(conf);
Mockito.when(clusterConn.getConnectionConfiguration()).thenReturn(connectionConfig);
}

@After
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public static ClusterConnection getMockedConnectionAndDecorate(final Configurati
RpcControllerFactory.instantiate(conf));
Mockito.when(c.getAsyncProcess()).thenReturn(asyncProcess);
Mockito.when(c.getNewRpcRetryingCallerFactory(conf))
.thenReturn(RpcRetryingCallerFactory.instantiate(conf, c.getConnectionConfiguration(),
.thenReturn(RpcRetryingCallerFactory.instantiate(conf, connectionConfiguration,
RetryingCallerInterceptorFactory.NO_OP_INTERCEPTOR, null, null));
Mockito.when(c.getRpcControllerFactory()).thenReturn(Mockito.mock(RpcControllerFactory.class));
Table t = Mockito.mock(Table.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public void testNoBulkLoadsWithNoWrites() throws Exception {

// The table is now in violation. Try to do a bulk load
ClientServiceCallable<Void> callable = helper.generateFileToLoad(tableName, 1, 50);
ClusterConnection conn = (ClusterConnection) TEST_UTIL.getConfiguration();
ClusterConnection conn = (ClusterConnection) TEST_UTIL.getConnection();
RpcRetryingCallerFactory factory =
new RpcRetryingCallerFactory(TEST_UTIL.getConfiguration(), conn.getConnectionConfiguration());
RpcRetryingCaller<Void> caller = factory.<Void> newCaller();
Expand Down

0 comments on commit 37591b1

Please sign in to comment.