### Question:
NodeGroup { int getCountOfMajor() { return (int) memberMap.values().stream().filter(GroupMember::isMajor).count(); } NodeGroup(NodeEndpoint endpoint);   NodeGroup(Collection<NodeEndpoint> endpoints, NodeId selfId);   }### Answer:
@Test public void testGetCountOfMajor() { NodeGroup group = new NodeGroup(new NodeEndpoint("A", "localhost", 2333)); group.addNode(new NodeEndpoint("B", "localhost", 2334), 1, 0, true); group.addNode(new NodeEndpoint("C", "localhost", 2335), 1, 0, false); Assert.assertEquals(2, group.getCountOfMajor()); }