Master master = new Master(_zk.getInteractionProtocol(), false);
Node node = Mocks.mockNode();// leave safe mode
_protocol.publishNode(node, new NodeMetaData("node1"));
master.start();
MasterOperation operation1 = mock(MasterOperation.class, withSettings().serializable());
MasterOperation operation2 = mock(MasterOperation.class, withSettings().serializable());
SerializableCountDownLatchAnswer answer = new SerializableCountDownLatchAnswer(2);
when(operation1.getExecutionInstruction((List<MasterOperation>) notNull()))
.thenReturn(ExecutionInstruction.EXECUTE);
when(operation2.getExecutionInstruction((List<MasterOperation>) notNull()))
.thenReturn(ExecutionInstruction.EXECUTE);
when(operation1.execute((MasterContext) notNull(), (List<MasterOperation>) notNull())).thenAnswer(answer);
when(operation2.execute((MasterContext) notNull(), (List<MasterOperation>) notNull())).thenAnswer(answer);
_protocol.addMasterOperation(operation1);
_protocol.addMasterOperation(operation2);
answer.getCountDownLatch().await();
master.shutdown();