diff options
author | Peter Wu <peter@lekensteyn.nl> | 2014-05-10 01:06:58 +0200 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2014-05-10 01:06:58 +0200 |
commit | 00d14d387bcb5a788195326c6893f729a9ee863d (patch) | |
tree | a7f1532da0f7008999544ceb2260491239264253 /test | |
parent | e4d8d30fca3bc621e0f5ec6eba6117b510621c6f (diff) | |
download | Datafiller-00d14d387bcb5a788195326c6893f729a9ee863d.tar.gz |
Detect wrong type for string
Diffstat (limited to 'test')
-rw-r--r-- | test/data/ValidatingJsonDeserializerTest.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/data/ValidatingJsonDeserializerTest.java b/test/data/ValidatingJsonDeserializerTest.java index a1f9884..a8b1955 100644 --- a/test/data/ValidatingJsonDeserializerTest.java +++ b/test/data/ValidatingJsonDeserializerTest.java @@ -7,6 +7,7 @@ import com.google.gson.JsonElement; import com.google.gson.JsonNull; import com.google.gson.JsonObject; import com.google.gson.JsonParseException; +import com.google.gson.JsonPrimitive; import org.apache.commons.lang3.StringUtils; import org.junit.Test; import static org.junit.Assert.*; @@ -536,6 +537,13 @@ public class ValidatingJsonDeserializerTest { } @Test + public void testWrongType() { + JsonObject tweet = buildMinimalTweet(buildMinimalUser()); + addProperty(tweet, new JsonPrimitive(1), "text"); + checkTweetFail(tweet, "Expected string: text"); + } + + @Test public void testNotATweetObject() { try { DebuggingJsonDeserializer.tryValidate("{}", Tweet.class); |