RepoBranchesMapper implements Func1<List<BranchDTO>, List<Branch>> { @Override public List<Branch> call(List<BranchDTO> branchDTOs) { if (branchDTOs == null) { return null; } List<Branch> branches = Observable.from(branchDTOs) .map(branchDTO -> new Branch(branchDTO.getName())) .toList() .toBlocking() .first(); return branches; } @Inject  RepoBranchesMapper(); @Override List<Branch> call(List<BranchDTO> branchDTOs);  }
@Test public void testCall() throws Exception { List<Branch> branchList = branchesMapper.call(branchDTOs); assertEquals(3, branchList.size()); assertEquals("QuickStart", branchList.get(0).getName()); assertEquals("gh-pages", branchList.get(1).getName()); assertEquals("master", branchList.get(2).getName()); }