forked from elunez/eladmin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unit tests for me.zhengjie.utils.StringUtils
- Loading branch information
zhengjie
committed
May 8, 2019
1 parent
3cde757
commit 333212a
Showing
8 changed files
with
59 additions
and
10 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
eladmin-common/src/test/java/me/zhengjie/utils/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,49 @@ | ||
package me.zhengjie.utils; | ||
|
||
import org.junit.Test; | ||
import org.springframework.mock.web.MockHttpServletRequest; | ||
|
||
import java.text.SimpleDateFormat; | ||
import java.util.*; | ||
|
||
import static me.zhengjie.utils.StringUtils.*; | ||
import static org.junit.Assert.*; | ||
|
||
public class StringUtilsTest { | ||
|
||
@Test | ||
public void testInString() { | ||
assertTrue(inString("?", "?")); | ||
assertFalse(inString("?", new String[]{})); | ||
} | ||
|
||
@Test | ||
public void testToCamelCase() { | ||
assertNull(toCamelCase(null)); | ||
} | ||
|
||
@Test | ||
public void testToCapitalizeCamelCase() { | ||
assertNull(StringUtils.toCapitalizeCamelCase(null)); | ||
assertEquals("HelloWorld", toCapitalizeCamelCase("hello_world")); | ||
} | ||
|
||
@Test | ||
public void testToUnderScoreCase() { | ||
assertNull(StringUtils.toUnderScoreCase(null)); | ||
assertEquals("hello_world", toUnderScoreCase("helloWorld")); | ||
assertEquals("\u0000\u0000", toUnderScoreCase("\u0000\u0000")); | ||
assertEquals("\u0000_a", toUnderScoreCase("\u0000A")); | ||
} | ||
|
||
@Test | ||
public void testGetWeekDay() { | ||
SimpleDateFormat simpleDateformat = new SimpleDateFormat("E"); | ||
assertEquals(simpleDateformat.format(new Date()), getWeekDay()); | ||
} | ||
|
||
@Test | ||
public void testGetIP() { | ||
assertEquals("127.0.0.1", getIP(new MockHttpServletRequest())); | ||
} | ||
} |
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
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
2 changes: 1 addition & 1 deletion
2
...va/me/zhengjie/util/AliPayStatusEnum.java → ...a/me/zhengjie/utils/AliPayStatusEnum.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package me.zhengjie.util; | ||
package me.zhengjie.utils; | ||
|
||
/** | ||
* 支付状态 | ||
|
2 changes: 1 addition & 1 deletion
2
...in/java/me/zhengjie/util/AlipayUtils.java → ...n/java/me/zhengjie/utils/AlipayUtils.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
4 changes: 2 additions & 2 deletions
4
...main/java/me/zhengjie/util/QiNiuUtil.java → ...ain/java/me/zhengjie/utils/QiNiuUtil.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