@Test public void processTags_최초_생성() throws Exception { // given Tag tag = new Tag("java"); String plainTags = "java newTags"; Set<Tag> originalTags = Sets.newHashSet(); when(tagRepository.findByName(tag.getName())).thenReturn(tag); // when dut.processTags(originalTags, plainTags); // then Set<Tag> tags = dut.getTags(); assertThat(tags.size(), is(1)); assertThat(tag.getTaggedCount(), is(1)); assertThat(dut.getDenormalizedTags(), is("java")); Set<NewTag> newTags = dut.getNewTags(); assertThat(newTags.size(), is(1)); }
@Test public void tagsToDenormalizedTags() throws Exception { Set<Tag> tags = Sets.newHashSet(new Tag("java"), new Tag("eclipse")); String result = TagProcessor.tagsToDenormalizedTags(tags); assertThat(result, is("java,eclipse")); }
@Test public void parseTags() throws Exception { String plainTags = "java javascript"; Set<String> parsedTags = TagProcessor.parseTags(plainTags); assertThat(parsedTags.size(), is(2)); }