-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9fd5e6b
commit 696a99f
Showing
2 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package org.mamute.util; | ||
|
||
import static org.hamcrest.Matchers.hasItems; | ||
import static org.junit.Assert.assertThat; | ||
|
||
import java.util.List; | ||
|
||
import org.junit.Test; | ||
|
||
public class TagsSplitterTest { | ||
|
||
@Test | ||
public void should_split_tags_based_on_regex_for_comma() { | ||
TagsSplitter tagsSplitter = new TagsSplitter("\\,"); | ||
List<String> splitTags = tagsSplitter.splitTags("java, ruby"); | ||
assertThat(splitTags, hasItems("java", "ruby")); | ||
} | ||
|
||
@Test | ||
public void should_split_tags_based_on_regex_for_space_character() { | ||
TagsSplitter tagsSplitter = new TagsSplitter("\\s+"); | ||
List<String> splitTags = tagsSplitter.splitTags("java ruby"); | ||
assertThat(splitTags, hasItems("java", "ruby")); | ||
} | ||
|
||
@Test | ||
public void should_split_tags_based_on_regex_for_both_comma_and_space_character() { | ||
TagsSplitter tagsSplitter = new TagsSplitter("[\\s+|\\,]"); | ||
List<String> splitTags = tagsSplitter.splitTags("java ruby,c"); | ||
assertThat(splitTags, hasItems("java", "ruby", "c")); | ||
} | ||
|
||
} |