Search in sources :

Example 1 with WordpressService

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());
}
Also used : WPJsonPost(org.michenux.drodrolib.wordpress.json.WPJsonPost) TestSubscriber(rx.observers.TestSubscriber) WPJsonResponse(org.michenux.drodrolib.wordpress.json.WPJsonResponse) WordpressService(org.michenux.yourappidea.tutorial.sync.WordpressService) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 WPJsonPost (org.michenux.drodrolib.wordpress.json.WPJsonPost)1 WPJsonResponse (org.michenux.drodrolib.wordpress.json.WPJsonResponse)1 WordpressService (org.michenux.yourappidea.tutorial.sync.WordpressService)1 TestSubscriber (rx.observers.TestSubscriber)1