Search in sources :

Example 1 with FeedTypeAdapter

use of email.schaal.ocreader.api.json.FeedTypeAdapter in project ocreader by schaal.

the class JsonTest method TestJsonWithUnexpectedNull.

@Test
public void TestJsonWithUnexpectedNull() throws IOException {
    Moshi moshi = new Moshi.Builder().add(Feed.class, new FeedTypeAdapter()).build();
    String feedJson = "{\"id\":28,\"url\":\"http://rss.slashdot.org/Slashdot/slashdot\",\"title\":\"Slashdot\",\"faviconLink\":null,\"added\":1435334890,\"folderId\":0,\"unreadCount\":1093,\"ordering\":null,\"link\":\"http://slashdot.org/\",\"pinned\":false}";
    Feed feed = moshi.adapter(Feed.class).fromJson(feedJson);
    assertNull(feed.getFaviconLink());
}
Also used : Moshi(com.squareup.moshi.Moshi) FeedTypeAdapter(email.schaal.ocreader.api.json.FeedTypeAdapter) Feed(email.schaal.ocreader.database.model.Feed) Test(org.junit.Test)

Aggregations

Moshi (com.squareup.moshi.Moshi)1 FeedTypeAdapter (email.schaal.ocreader.api.json.FeedTypeAdapter)1 Feed (email.schaal.ocreader.database.model.Feed)1 Test (org.junit.Test)1