use of org.michenux.yourappidea.tutorial.sync.WordpressService in project YourAppIdea by Michenux.
the class WordpressServiceTest method testQuery.
@Test
public void testQuery() throws Exception {
WordpressService wordpressService = WordpressServiceFactory.create(mContext);
Observable<WPJsonResponse> observable = wordpressService.query("get_recent_posts", "android", "android_desc", "android", 9999);
TestSubscriber<WPJsonResponse> testSubscriber = new TestSubscriber<>();
observable.subscribe(testSubscriber);
testSubscriber.assertNoErrors();
List<WPJsonResponse> jsonPosts = testSubscriber.getOnNextEvents();
Assert.assertNotNull(jsonPosts);
Assert.assertFalse(jsonPosts.isEmpty());
WPJsonResponse response = jsonPosts.get(0);
Assert.assertEquals(response.getStatus(), "ok");
List<WPJsonPost> posts = response.getPosts();
Assert.assertNotNull(posts);
Assert.assertFalse(posts.isEmpty());
}
Aggregations