src/test/java/tech/zettervall/openlibrary/rxclient/OpenLibraryClientTest.java
/**
     * Test a successful API fetch of SearchResult (Q).
     */
Test a successful API fetch of SearchResult (Q).
Test a successful API fetch of SearchResult ( Q ) .
@Test
    public void searchByQSuccess() {
        openLibraryClient.getRepository().search(Repository.SearchType.Q, "the lord of the rings", null)
                .blockingSubscribe(new DisposableSingleObserver<SearchResult>() {
                    @Override
                    public void onSuccess(@NonNull SearchResult searchResult) {
                        assertEquals(100, searchResult.getResults().length);
                        assertTrue(searchResult.getResults()[0].getTitle().toLowerCase().contains("the lord of the rings"));
                        System.out.println("Received: " + searchResult);
                    }
                    @Override
                    public void onError(@NonNull Throwable e) {
                        fail();
                    }
                });
    }
@ Test public void searchByQSuccess ( ) { openLibraryClient . getRepository ( ) . search ( Repository . SearchType . Q , "the lord of the rings" , null ) . blockingSubscribe ( new DisposableSingleObserver < SearchResult > ( ) { @ Override public void onSuccess ( @ NonNull SearchResult searchResult ) { assertEquals ( 100 , searchResult . getResults ( ) . length ) ; assertTrue ( searchResult . getResults ( ) [ 0 ] . getTitle ( ) . toLowerCase ( ) . contains ( "the lord of the rings" ) ) ; System . out . println ( "Received: " + searchResult ) ; } @ Override public void onError ( @ NonNull Throwable e ) { fail ( ) ; } } ) ; }
Test a successful API fetch of SearchResult (Q).
Test a successful API fetch of SearchResult ( Q ) .