Source:
<code>public void testRemovalOfIpAddressWithDifferentLocationsInDefinitions() throws IOException { String snmpConfigXml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" + "<snmp-config retry=\"3\" timeout=\"800\" read-community=\"public\" write-community=\"private\" xmlns=\"<LINK_0>\">\n" + " <definition version=\"v1\" timeout=\"1200\">\n" + " <range begin=\"192.168.1.15\" end=\"192.168.1.35\"/>\n" + " </definition>\n" + " <definition version=\"v1\" location=\"Minion\">\n" + " <range begin=\"192.168.1.15\" end=\"192.168.1.35\"/>\n" + " </definition>\n" + "</snmp-config>\n" + ""; String expectedConfig = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" + "<snmp-config retry=\"3\" timeout=\"800\" read-community=\"public\" write-community=\"private\" xmlns=\"<LINK_0>\">\n" + " <definition version=\"v1\" timeout=\"1200\" >\n" + " <range begin=\"192.168.1.15\" end=\"192.168.1.35\"/>\n" + " </definition>\n" + " <definition version=\"v1\" location=\"Minion\">\n" + " <range begin=\"192.168.1.15\" end=\"192.168.1.24\"/>\n" + " <range begin=\"192.168.1.26\" end=\"192.168.1.35\"/>\n" + " </definition>\n" + "</snmp-config>\n" + ""; SnmpPeerFactory.setInstance(new SnmpPeerFactory(new StringResource(snmpConfigXml))); assertXmlEquals(snmpConfigXml, SnmpPeerFactory.getInstance().getSnmpConfigAsString()); SnmpPeerFactory.getInstance().removeFromDefinition(InetAddress.getByName("192.168.1.25"), "Minion", "test"); SnmpAgentConfig snmpAgentConfig = SnmpPeerFactory.getInstance().getAgentConfig(InetAddress.getByName("192.168.1.25")); <START> assertFalse(snmpAgentConfig.isDefault()); <END> String actualConfig = SnmpPeerFactory.getInstance().getSnmpConfigAsString(); assertXmlEquals(expectedConfig, actualConfig); }</code><technical_language>helps include a message in assertTrue/assertFalse calls - output is helpful fail</technical_language>

Target:
public void testRemovalOfIpAddressWithDifferentLocationsInDefinitions() throws IOException { String snmpConfigXml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" + "<snmp-config retry=\"3\" timeout=\"800\" read-community=\"public\" write-community=\"private\" xmlns=\"<LINK_0>\">\n" + " <definition version=\"v1\" timeout=\"1200\">\n" + " <range begin=\"192.168.1.15\" end=\"192.168.1.35\"/>\n" + " </definition>\n" + " <definition version=\"v1\" location=\"Minion\">\n" + " <range begin=\"192.168.1.15\" end=\"192.168.1.35\"/>\n" + " </definition>\n" + "</snmp-config>\n" + ""; String expectedConfig = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" + "<snmp-config retry=\"3\" timeout=\"800\" read-community=\"public\" write-community=\"private\" xmlns=\"<LINK_0>\">\n" + " <definition version=\"v1\" timeout=\"1200\" >\n" + " <range begin=\"192.168.1.15\" end=\"192.168.1.35\"/>\n" + " </definition>\n" + " <definition version=\"v1\" location=\"Minion\">\n" + " <range begin=\"192.168.1.15\" end=\"192.168.1.24\"/>\n" + " <range begin=\"192.168.1.26\" end=\"192.168.1.35\"/>\n" + " </definition>\n" + "</snmp-config>\n" + ""; SnmpPeerFactory.setInstance(new SnmpPeerFactory(new StringResource(snmpConfigXml))); assertXmlEquals(snmpConfigXml, SnmpPeerFactory.getInstance().getSnmpConfigAsString()); SnmpPeerFactory.getInstance().removeFromDefinition(InetAddress.getByName("192.168.1.25"), "Minion", "test"); SnmpAgentConfig snmpAgentConfig = SnmpPeerFactory.getInstance().getAgentConfig(InetAddress.getByName("192.168.1.25"), "Minion"); assertFalse("Config should be derived from default location", snmpAgentConfig.isDefault()); String actualConfig = SnmpPeerFactory.getInstance().getSnmpConfigAsString(); assertXmlEquals(expectedConfig, actualConfig); }