ServicePort { public boolean hasTags(String... tag) { if (tags == null) { return false; } List<String> isTaggedWith = splitOnSpace.splitToList(tags); for (String t : tag) { if (!isTaggedWith.contains(t)) { return false; } } return true; }  boolean hasTags(String... tag); public int number; public String tags; }
@Test public final void testNullTags() { ServicePort s = new ServicePort(); s.tags = null; assertFalse(s.hasTags("http")); }
@Test public final void testEmptyTags() { ServicePort s = new ServicePort(); s.tags = ""; assertFalse(s.hasTags("http")); }
@Test public final void testSubsetInArgs() { ServicePort s = new ServicePort(); s.tags = "http state status"; assertTrue(s.hasTags("http", "state")); }
@Test public final void testSupersetInArgs() { ServicePort s = new ServicePort(); s.tags = "http"; assertFalse(s.hasTags("http", "rpc")); }
@Test public final void testIdenticalInArgs() { ServicePort s = new ServicePort(); s.tags = "http rpc"; assertTrue(s.hasTags("http", "rpc")); }
@Test public final void testDisjunctBetweenArgsAndTags() { ServicePort s = new ServicePort(); s.tags = "http state moo"; assertFalse(s.hasTags("http", "state", "rpc")); }
@Test public final void testTagNameStartsWithOther() { ServicePort s = new ServicePort(); s.tags = "http state moo"; assertFalse(s.hasTags("htt")); }
@Test public final void testTagNameEndsWithOther() { ServicePort s = new ServicePort(); s.tags = "http state moo"; assertFalse(s.hasTags("tp")); }
@Test public final void testTagNameIsSubstringofOther() { ServicePort s = new ServicePort(); s.tags = "http state moo"; assertFalse(s.hasTags("tt")); }