### Question:
NodeManager implements EventHandler { public List<NodeHandler> dumpActiveNodes() { List<NodeHandler> handlers = new ArrayList<>(); for (NodeHandler handler : this.nodeHandlerMap.values()) { if (isNodeAlive(handler)) { handlers.add(handler); } } return handlers; } @Autowired  NodeManager(ChainBaseManager chainBaseManager); ScheduledExecutorService getPongTimer(); @Override void channelActivated(); boolean isNodeAlive(NodeHandler nodeHandler); void setMessageSender(Consumer<UdpEvent> messageSender); NodeHandler getNodeHandler(Node n); boolean hasNodeHandler(Node n); NodeTable getTable(); NodeStatistics getNodeStatistics(Node n); @Override void handleEvent(UdpEvent udpEvent); void sendOutbound(UdpEvent udpEvent); List<NodeHandler> getNodes(Predicate<NodeHandler> predicate, int limit); List<NodeHandler> dumpActiveNodes(); Node getPublicHomeNode(); void close();  }### Answer:
@Test public void dumpActiveNodesTest() { Node node1 = new Node(new byte[64], "128.0.0.1", 18888, 18888); Node node2 = new Node(new byte[64], "128.0.0.2", 18888, 18888); Node node3 = new Node(new byte[64], "128.0.0.3", 18888, 18888); NodeHandler nodeHandler1 = nodeManager.getNodeHandler(node1); NodeHandler nodeHandler2 = nodeManager.getNodeHandler(node2); NodeHandler nodeHandler3 = nodeManager.getNodeHandler(node3); nodeHandler1.changeState(NodeHandler.State.ALIVE); nodeHandler2.changeState(NodeHandler.State.ACTIVE); nodeHandler3.changeState(NodeHandler.State.NONACTIVE); int activeNodes = nodeManager.dumpActiveNodes().size(); Assert.assertEquals(2, activeNodes); }