### Question:
NodeManager implements INodeManager { @Override public synchronized boolean createNetwork() { createNode(); String nodeID = generateNodeID(); networkConfiguration = NetworkConfiguration.createInitial(nodeID); boolean success = node.connect(networkConfiguration); success = success && isConnected(); if (success) { notifyConnect("localhost"); } return success; } @Inject  NodeManager(final MessageBus messageBus); @Override synchronized boolean joinNetwork(List<String> bootstrappingNodes); @Override synchronized boolean joinNetwork(final String address); @Override synchronized boolean createNetwork(); @Override synchronized boolean leaveNetwork(); @Override boolean isConnected(); @Override IH2HNode getNode(); @Override INetworkConfiguration getNetworkConfiguration(); @Override IFileConfiguration getFileConfiguration();  }### Answer:
@Test public void testCreateNetwork() { boolean ret = nodeManager.createNetwork(); assertTrue(ret); assertTrue(nodeManager.getNetworkConfiguration().isInitial()); ArgumentCaptor<NodeConnectMessage> event = ArgumentCaptor.forClass(NodeConnectMessage.class); Mockito.verify(messageBus, Mockito.times(1)).publish(event.capture()); assertNotNull(event.getValue()); assertTrue(event.getValue() instanceof NodeConnectMessage); assertEquals(event.getValue().getNodeAddress(), "localhost"); }