JanusRestClient implements Janus { @Override public List<String> getAllowedSps(String idpentityid) { return getAllowedSps(idpentityid, null); } JanusRestClient(); @Override EntityMetadata getMetadataByEntityId(String entityId); @Override List<String> getEntityIdsByMetaData(Metadata key, String value); @Override List<String> getAllowedSps(String idpentityid); @Override List<String> getAllowedSps(String idpentityid, String revision); @Override List<EntityMetadata> getSpList(); @Override List<EntityMetadata> getIdpList(); @Override ARP getArp(String entityId); @Override boolean isConnectionAllowed(String spEntityId, String idpEntityId); @Override JanusEntity getEntity(String entityId); void setRestTemplate(RestTemplate restTemplate); void setJanusUri(URI janusUri); void setUser(String user); void setSecret(String secret);  }
@Test public void getAllowedSps() { ArgumentCaptor<URI> captor = ArgumentCaptor.forClass(URI.class); final List<String> ids = new ArrayList<String>(Arrays.asList("id1", "id2")); when(restTemplate.getForObject((URI) anyObject(), eq(List.class))).thenReturn(ids); List<String> result = janusRestClient.getAllowedSps("boobaa"); assertEquals("id1", result.get(0)); assertEquals("id2", result.get(1)); verify(restTemplate).getForObject(captor.capture(), eq(List.class)); assertTrue("Query string should contain correct idpentityid", captor.getValue().getQuery().contains("idpentityid=boobaa")); assertTrue("Query string should contain correct method", captor.getValue().getQuery().contains ("method=getAllowedSps")); assertTrue("Query string should contain correct user", captor.getValue().getQuery().contains("userid=user")); }