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