RegisterEntry { public boolean matches(RegisterEntry re) { return (re.port == -1 || re.port == port) && (isNull(re.hostname) || nonNull(hostname) && hostname.startsWith(re.hostname)) && (isNull(re.module) || nonNull(module) && module.startsWith(re.module)) && (isNull(re.context) || nonNull(context) && context.startsWith(re.context)) && (isNull(re.health) || re.health.equals(health)) && (re.externalPort == -1 || re.externalPort == externalPort) && (isNull(re.manifest) || re.manifest.isEmpty() || matchManifest(re.manifest)); } RegisterEntry();  RegisterEntry(int port, String hostname, String module, String context, Date time,
        String uuid,
        String target, int externalPort);  RegisterEntry(int port, String hostname, String module, String context, Date time,
        String target,
        int externalPort); private  RegisterEntry(int port, String hostname, String module, String context, Date time,
        String uuid,
        String target, String ignoreDate, Health health,
        List<Map<String, Map<String, String>>> stats,
        int externalPort); boolean matches(RegisterEntry re);  }
@Test public void matches() throws Exception { RegisterEntry re = new RegisterEntry(); re.getManifest().clear(); assertFalse(entry.matches(re)); re = RegisterEntry.builder().port(8080).externalPort(-1).build(); re.getManifest().clear(); assertTrue(entry.matches(re)); re = RegisterEntry.builder().port(8080).externalPort(9090).build(); re.getManifest().clear(); assertTrue(entry.matches(re)); re = RegisterEntry.builder().port(8080).hostname("host").externalPort(9090).build(); re.getManifest().clear(); assertTrue(entry.matches(re)); re = RegisterEntry.builder().port(8080).hostname("host1").externalPort(9090).build(); re.getManifest().clear(); assertFalse(entry.matches(re)); re = RegisterEntry.builder().port(8080).hostname("host").externalPort(9090).build(); re.getManifest().clear(); re.getManifest().put("Implementation-revision", "a2edfe4bc"); assertTrue(entry.matches(re)); re = RegisterEntry.builder().port(8080).hostname("host").externalPort(9090).build(); re.getManifest().clear(); re.getManifest().put("Implementation-Version", "version1"); assertFalse(entry.matches(re)); }