forked from citrusframework/citrus
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(citrus-base): add string utils tests
- Loading branch information
Showing
2 changed files
with
56 additions
and
4 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
56 changes: 56 additions & 0 deletions
56
core/citrus-base/src/test/java/org/citrusframework/util/StringUtilsTest.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,56 @@ | ||
package org.citrusframework.util; | ||
|
||
import static org.citrusframework.util.StringUtils.hasText; | ||
import static org.citrusframework.util.StringUtils.isEmpty; | ||
import static org.testng.Assert.assertFalse; | ||
import static org.testng.Assert.assertTrue; | ||
|
||
import org.testng.annotations.DataProvider; | ||
import org.testng.annotations.Test; | ||
|
||
public class StringUtilsTest { | ||
|
||
@DataProvider | ||
public static Object[][] text() { | ||
return new Object[][]{{"foo"}}; | ||
} | ||
|
||
@DataProvider | ||
public static Object[][] blankText() { | ||
return new Object[][]{{" "}}; | ||
} | ||
|
||
@DataProvider | ||
public static Object[][] emptyText() { | ||
return new Object[][]{{null}, {""}}; | ||
} | ||
|
||
@Test(dataProvider = "text") | ||
public void hasText_returnsTrue(String str) { | ||
assertTrue(hasText(str)); | ||
} | ||
|
||
@Test(dataProvider = "blankText") | ||
public void hasText_returnsFalse_forBlankText(String str) { | ||
assertFalse(hasText(str)); | ||
} | ||
@Test(dataProvider = "emptyText") | ||
public void hasText_returnsFalse_forEmptyText(String str) { | ||
assertFalse(hasText(str)); | ||
} | ||
|
||
@Test(dataProvider = "emptyText") | ||
public void isEmpty_returnsTrue(String str) { | ||
assertTrue(isEmpty(str)); | ||
} | ||
|
||
@Test(dataProvider = "text") | ||
public void isEmpty_returnsFalse_forText(String str) { | ||
assertFalse(isEmpty(str)); | ||
} | ||
|
||
@Test(dataProvider = "blankText") | ||
public void isEmpty_returnsFalse_forBlankText(String str) { | ||
assertFalse(isEmpty(str)); | ||
} | ||
} |