ParseServerNameToCredentialsMapFromJsonResponse implements
      Function<HttpResponse, Map<String, Credentials>> { @Override public Map<String, Credentials> apply(HttpResponse arg0) { Map<String, Credentials> serverNameToCredentials = Maps.newHashMap(); for (Password password : json.apply(arg0).getList()) { if (null != password.getServer()) serverNameToCredentials.put(password.getServer().getName(), new Credentials(password.getUserName(), password.getPassword())); } return serverNameToCredentials; } @Inject  ParseServerNameToCredentialsMapFromJsonResponse(
         ParseJson<GenericResponseContainer<Password>> json); @Override Map<String, Credentials> apply(HttpResponse arg0);  }
@Test public void testApplyInputStreamDetails() throws UnknownHostException { InputStream is = getClass().getResourceAsStream("/test_credentials_list.json"); ParseServerNameToCredentialsMapFromJsonResponse parser = i .getInstance(ParseServerNameToCredentialsMapFromJsonResponse.class); Map<String, Credentials> response = parser.apply(HttpResponse.builder().statusCode(200).message("ok").payload(is).build()); assertEquals(response.size(), 6); }