forked from chanjarster/weixin-java-tools
-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
31ecd4d
commit 07352d1
Showing
7 changed files
with
219 additions
and
41 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
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
139 changes: 139 additions & 0 deletions
139
weixin-java-common/src/test/java/me/chanjar/weixin/common/util/json/GsonHelperTest.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,139 @@ | ||
package me.chanjar.weixin.common.util.json; | ||
|
||
import com.google.gson.JsonObject; | ||
import org.testng.annotations.Test; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
/** | ||
* GsonHelper 的单元测试. | ||
* | ||
* @author <a href="https://github.com/binarywang">Binary Wang</a> | ||
* @date 2020-09-04 | ||
*/ | ||
public class GsonHelperTest { | ||
|
||
@Test | ||
public void testIsNull() { | ||
} | ||
|
||
@Test | ||
public void testIsNotNull() { | ||
} | ||
|
||
@Test | ||
public void testGetLong() { | ||
} | ||
|
||
@Test | ||
public void testGetPrimitiveLong() { | ||
} | ||
|
||
@Test | ||
public void testGetInteger() { | ||
} | ||
|
||
@Test | ||
public void testGetPrimitiveInteger() { | ||
} | ||
|
||
@Test | ||
public void testGetDouble() { | ||
} | ||
|
||
@Test | ||
public void testGetPrimitiveDouble() { | ||
} | ||
|
||
@Test | ||
public void testGetFloat() { | ||
} | ||
|
||
@Test | ||
public void testGetPrimitiveFloat() { | ||
} | ||
|
||
@Test | ||
public void testGetBoolean() { | ||
} | ||
|
||
@Test | ||
public void testGetString() { | ||
} | ||
|
||
@Test | ||
public void testGetAsString() { | ||
} | ||
|
||
@Test | ||
public void testGetAsLong() { | ||
} | ||
|
||
@Test | ||
public void testGetAsPrimitiveLong() { | ||
} | ||
|
||
@Test | ||
public void testGetAsInteger() { | ||
} | ||
|
||
@Test | ||
public void testGetAsPrimitiveInt() { | ||
} | ||
|
||
@Test | ||
public void testGetAsBoolean() { | ||
} | ||
|
||
@Test | ||
public void testGetAsPrimitiveBool() { | ||
} | ||
|
||
@Test | ||
public void testGetAsDouble() { | ||
} | ||
|
||
@Test | ||
public void testGetAsPrimitiveDouble() { | ||
} | ||
|
||
@Test | ||
public void testGetAsFloat() { | ||
} | ||
|
||
@Test | ||
public void testGetAsPrimitiveFloat() { | ||
} | ||
|
||
@Test | ||
public void testGetIntArray() { | ||
} | ||
|
||
@Test | ||
public void testGetStringArray() { | ||
} | ||
|
||
@Test | ||
public void testGetLongArray() { | ||
} | ||
|
||
@Test | ||
public void testGetAsJsonArray() { | ||
} | ||
|
||
@Test | ||
public void testBuildSimpleJsonObject() { | ||
try { | ||
GsonHelper.buildJsonObject(1, 2, 3); | ||
} catch (RuntimeException e) { | ||
assertThat(e.getMessage()).isEqualTo("参数个数必须为偶数"); | ||
} | ||
|
||
System.out.println(GsonHelper.buildJsonObject(1, 2)); | ||
System.out.println(GsonHelper.buildJsonObject(1, null)); | ||
System.out.println(GsonHelper.buildJsonObject("int", 1, "float", 2.1f, "double", 2.5)); | ||
System.out.println(GsonHelper.buildJsonObject("boolean", true, "string", "1av")); | ||
System.out.println(GsonHelper.buildJsonObject(1, true, "jsonElement", new JsonObject())); | ||
System.out.println(GsonHelper.buildJsonObject("num", 2, "string", "cde", "char", 'a', "bool", true)); | ||
} | ||
} |
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