RepoListMapper implements Func1<List<RepositoryDTO>, List<Repository>> { @Override public List<Repository> call(List<RepositoryDTO> repositoryDTOs) { if (repositoryDTOs == null) { return null; } List<Repository> repoList = Observable.from(repositoryDTOs) .map(repoDTO -> new Repository(repoDTO.getName(), repoDTO.getOwner().getLogin())) .toList() .toBlocking() .first(); return repoList; } @Inject  RepoListMapper(); @Override List<Repository> call(List<RepositoryDTO> repositoryDTOs);  }
@Test public void testCall() throws Exception { List<Repository> repositoryList = repoListMapper.call(repositoryDTOs); assertEquals(7, repositoryList.size()); assertEquals("Android-Rate", repositoryList.get(0).getRepoName()); assertEquals("andrey7mel", repositoryList.get(0).getOwnerName()); assertEquals("utils", repositoryList.get(6).getRepoName()); assertEquals("andrey7mel", repositoryList.get(6).getOwnerName()); }