### Question:
NodeGroup { void upgrade(NodeId id) { logger.info("upgrade node {}", id); findMember(id).setMajor(true); } NodeGroup(NodeEndpoint endpoint);   NodeGroup(Collection<NodeEndpoint> endpoints, NodeId selfId);   }### Answer:
@Test public void testUpgrade() { NodeGroup group = new NodeGroup(new NodeEndpoint("A", "localhost", 2333)); NodeEndpoint endpoint = new NodeEndpoint("B", "localhost", 2334); group.addNode(endpoint, 1, 0, false); Assert.assertEquals(1, group.getCountOfMajor()); group.upgrade(endpoint.getId()); Assert.assertEquals(2, group.getCountOfMajor()); }
@Test(expected = IllegalArgumentException.class) public void testUpgradeNodeNotFound() { NodeGroup group = new NodeGroup(new NodeEndpoint("A", "localhost", 2333)); group.upgrade(new NodeId("B")); }