-
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.
Updated some SDK code to avoid warning messages from code scanning tools. This includes a change to the StringReader#skip method, which now explicitly checks for negative values. Reviewer: vyhhuang Reviewer: dougbulkley JiraIssue: DS-48860
- Loading branch information
1 parent
2f6ec9b
commit 371487f
Showing
3 changed files
with
110 additions
and
7 deletions.
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
89 changes: 89 additions & 0 deletions
89
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,89 @@ | ||
/* | ||
* Copyright 2024 Ping Identity Corporation | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License (GPLv2 only) | ||
* or the terms of the GNU Lesser General Public License (LGPLv2.1 only) | ||
* as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, see <http://www.gnu.org/licenses>. | ||
*/ | ||
|
||
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 | ||
{ | ||
/** | ||
* Unit test for the {@code splitCommaSeparatedString()} method. | ||
*/ | ||
@Test | ||
public void testSplitCommaSeparatedString() | ||
{ | ||
// Ensure the validity of the @NotNull parameter. | ||
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"); | ||
} | ||
} |