-
Notifications
You must be signed in to change notification settings - Fork 76
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
d5c2e1f
commit 62ce5bd
Showing
1 changed file
with
69 additions
and
0 deletions.
There are no files selected for viewing
69 changes: 69 additions & 0 deletions
69
scim2-sdk-common/src/test/java/com/unboundid/scim2/common/StaticUtilsTest.java
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,69 @@ | ||
package com.unboundid.scim2.common; | ||
|
||
import org.testng.annotations.Test; | ||
|
||
import static com.unboundid.scim2.common.utils.StaticUtils.splitCommaSeparatedString; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.assertj.core.api.Assertions.assertThatThrownBy; | ||
|
||
public class StaticUtilsTest | ||
{ | ||
@Test | ||
public void testSplitCommaSeparatedString() | ||
{ | ||
// Ensure that the @NotNull parameter is not permitted. | ||
assertThatThrownBy(() -> splitCommaSeparatedString(null)) | ||
.isInstanceOf(NullPointerException.class); | ||
|
||
assertThat(splitCommaSeparatedString("value")) | ||
.containsExactly("value"); | ||
|
||
assertThat(splitCommaSeparatedString(" value")) | ||
.containsExactly("value"); | ||
|
||
assertThat(splitCommaSeparatedString("value ")) | ||
.containsExactly("value"); | ||
|
||
assertThat(splitCommaSeparatedString(" value ")) | ||
.containsExactly("value"); | ||
|
||
assertThat(splitCommaSeparatedString(" value ")) | ||
.containsExactly("value"); | ||
|
||
assertThat(splitCommaSeparatedString("\tvalue\t")) | ||
.containsExactly("value"); | ||
|
||
assertThat(splitCommaSeparatedString("value1,value2")) | ||
.containsExactly("value1", "value2"); | ||
|
||
assertThat(splitCommaSeparatedString(" value1,value2")) | ||
.containsExactly("value1", "value2"); | ||
|
||
assertThat(splitCommaSeparatedString("value1 ,value2")) | ||
.containsExactly("value1", "value2"); | ||
|
||
assertThat(splitCommaSeparatedString("value1, value2")) | ||
.containsExactly("value1", "value2"); | ||
|
||
assertThat(splitCommaSeparatedString("value1,value2 ")) | ||
.containsExactly("value1", "value2"); | ||
|
||
assertThat(splitCommaSeparatedString(" value1 , value2 ")) | ||
.containsExactly("value1", "value2"); | ||
|
||
assertThat(splitCommaSeparatedString("value1 , value2 , value3")) | ||
.containsExactly("value1", "value2", "value3"); | ||
|
||
assertThat(splitCommaSeparatedString(" value1 , value2 , value3 ")) | ||
.containsExactly("value1", "value2", "value3"); | ||
|
||
assertThat(splitCommaSeparatedString(",")) | ||
.isEmpty(); | ||
|
||
assertThat(splitCommaSeparatedString(",,")) | ||
.isEmpty(); | ||
|
||
assertThat(splitCommaSeparatedString(" value1 , , value3 ")) | ||
.containsExactly("value1", "", "value3"); | ||
} | ||
} |