private ContextChainHolderImpl contextChainHolder;
private ReconciliationFrameworkRegistration registration;
- private MastershipChangeServiceManager manager = new MastershipChangeServiceManagerImpl();
+ private final MastershipChangeServiceManager manager = new MastershipChangeServiceManagerImpl();
@Before
public void setUp() throws Exception {
- Mockito.doAnswer(invocation -> {
- invocation.getArgumentAt(0, Runnable.class).run();
- return null;
- }).when(executorService).submit(Mockito.<Runnable>any());
-
-
Mockito.when(connectionContext.getDeviceInfo()).thenReturn(deviceInfo);
Mockito.when(deviceManager.createContext(connectionContext)).thenReturn(deviceContext);
Mockito.when(rpcManager.createContext(deviceContext)).thenReturn(rpcContext);
@Test
public void reconciliationFrameworkSuccessButNotSubmit() throws Exception {
contextChainHolder.createContextChain(connectionContext);
- Mockito.when(reconciliationFrameworkEvent.onDevicePrepared(deviceInfo))
- .thenReturn(Futures.immediateFuture(ResultState.DONOTHING));
+ // TODO when if (future != null) check in MastershipChangeServiceManagerImpl's becomeSlaveOrDisconnect() is rm
+ // Mockito.when(reconciliationFrameworkEvent.onDevicePrepared(deviceInfo))
+ // .thenReturn(Futures.immediateFuture(null));
contextChainHolder.createContextChain(connectionContext);
contextChainHolder.onMasterRoleAcquired(deviceInfo, ContextChainMastershipState.INITIAL_FLOW_REGISTRY_FILL);
contextChainHolder.onMasterRoleAcquired(deviceInfo, ContextChainMastershipState.RPC_REGISTRATION);