Search in sources :

Example 1 with MarvelApiException

use of com.karumi.marvelapiclient.MarvelApiException in project Rosie by Karumi.

the class MainActivityTest method givenExceptionObtainingCharacters.

private void givenExceptionObtainingCharacters() throws Exception {
    when(charactersRepository.getAll(ReadPolicy.CACHE_ONLY)).thenReturn(new ArrayList<Character>());
    when(charactersRepository.getPage(any(Page.class))).thenThrow(new MarvelApiException(ANY_EXCEPTION, null));
}
Also used : MarvelApiException(com.karumi.marvelapiclient.MarvelApiException) Character(com.karumi.rosie.sample.characters.domain.model.Character) Page(com.karumi.rosie.repository.datasource.paginated.Page)

Example 2 with MarvelApiException

use of com.karumi.marvelapiclient.MarvelApiException in project Rosie by Karumi.

the class MainActivityTest method givenConnectionExceptionObtainingCharacters.

private void givenConnectionExceptionObtainingCharacters() throws Exception {
    when(charactersRepository.getAll(ReadPolicy.CACHE_ONLY)).thenReturn(new ArrayList<Character>());
    when(charactersRepository.getPage(any(Page.class))).thenThrow(new MarvelApiException(ANY_EXCEPTION, new UnknownHostException()));
}
Also used : MarvelApiException(com.karumi.marvelapiclient.MarvelApiException) Character(com.karumi.rosie.sample.characters.domain.model.Character) UnknownHostException(java.net.UnknownHostException) Page(com.karumi.rosie.repository.datasource.paginated.Page)

Aggregations

MarvelApiException (com.karumi.marvelapiclient.MarvelApiException)2 Page (com.karumi.rosie.repository.datasource.paginated.Page)2 Character (com.karumi.rosie.sample.characters.domain.model.Character)2 UnknownHostException (java.net.UnknownHostException)1