From 3b51077b5f5477be6bbfc9d6a7d5bc88c66be68d Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Mon, 12 May 2014 10:41:57 +0200 Subject: Fix tests for nullable properties --- test/data/ValidatingJsonDeserializerTest.java | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/data/ValidatingJsonDeserializerTest.java b/test/data/ValidatingJsonDeserializerTest.java index 214f33f..fdaf27f 100644 --- a/test/data/ValidatingJsonDeserializerTest.java +++ b/test/data/ValidatingJsonDeserializerTest.java @@ -450,7 +450,6 @@ public class ValidatingJsonDeserializerTest { @Test public void testTweet() { checkImpairedTweet("id"); - checkImpairedTweet("lang"); checkImpairedTweet("created_at"); checkImpairedTweet("favorite_count"); checkImpairedTweet("text"); @@ -472,6 +471,10 @@ public class ValidatingJsonDeserializerTest { tweet = buildMinimalTweet(buildMinimalUser()); removeProperty(tweet, "coordinates"); checkTweetPass(tweet); + + tweet = buildMinimalTweet(buildMinimalUser()); + removeProperty(tweet, "lang"); + checkTweetPass(tweet); } @Test @@ -514,16 +517,14 @@ public class ValidatingJsonDeserializerTest { checkImpairedUser("statuses_count"); checkImpairedUser("followers_count"); checkImpairedUser("friends_count"); - checkImpairedUser("location"); checkImpairedUser("screen_name"); checkImpairedUser("created_at"); checkImpairedUser("lang"); - checkImpairedUser("description"); checkImpairedUser("verified"); } @Test - public void testNullUserEntities() { + public void testNullUserFields() { // entities can be null JsonObject tweet = buildMinimalTweet(buildMinimalUser()); removeProperty(tweet, "user", "entities"); @@ -532,6 +533,14 @@ public class ValidatingJsonDeserializerTest { tweet = buildMinimalTweet(buildMinimalUser()); removeProperty(tweet, "user", "time_zone"); checkTweetPass(tweet); + + tweet = buildMinimalTweet(buildMinimalUser()); + removeProperty(tweet, "user", "location"); + checkTweetPass(tweet); + + tweet = buildMinimalTweet(buildMinimalUser()); + removeProperty(tweet, "user", "description"); + checkTweetPass(tweet); } @Test @@ -563,11 +572,15 @@ public class ValidatingJsonDeserializerTest { } @Test - public void testNullPlace() { + public void testNullTweetFields() { JsonObject tweet = buildMinimalTweet(buildMinimalUser()); removeProperty(tweet, "place"); tweet.add("place", null); checkTweetPass(tweet); + + tweet = buildMinimalTweet(buildMinimalUser()); + removeProperty(tweet, "lang"); + checkTweetPass(tweet); } @Test -- cgit v1.2.1