@Test public void testConcatVararg() throws Exception { Map<String, String> map = ImmutableMap.of("foo", "bar", "dee", "dum"); TagList t1 = BasicTagList.of("foo", "bar"); TagList tags = BasicTagList.concat(t1, new BasicTag("dee", "dum")); assertEquals(tags.asMap(), map); }
@Test public void testCopyOfIterableString() throws Exception { Map<String, String> map = ImmutableMap.of("foo", "bar", "dee", "dum"); List<String> input = ImmutableList.of("foo=bar", "dee=dum"); TagList tags = BasicTagList.copyOf(input); assertEquals(tags.asMap(), map); }
@Test public void testConcatOverride() throws Exception { Map<String, String> map = ImmutableMap.of("foo", "bar2"); TagList t1 = BasicTagList.of("foo", "bar"); TagList t2 = BasicTagList.of("foo", "bar2"); TagList tags = BasicTagList.concat(t1, t2); assertEquals(tags.asMap(), map); }
@Test public void testAccessors() throws Exception { TagList t1 = BasicTagList.of("foo", "bar"); assertTrue(!t1.isEmpty()); assertEquals(t1.size(), 1); assertEquals(t1.getTag("foo"), new BasicTag("foo", "bar")); assertTrue(t1.getTag("dee") == null, "dee is not a tag"); assertTrue(t1.containsKey("foo")); assertTrue(!t1.containsKey("dee")); }
@Test public void testEmpty() throws Exception { TagList t1 = BasicTagList.EMPTY; assertTrue(t1.isEmpty()); assertEquals(t1.size(), 0); }