RestServiceImpl implements RestService { @Override public Response getHosts() { Set<ResourceHostInfo> hosts = hostRegistry.getResourceHostsInfo(); return Response.ok( JsonUtil.toJson( hosts ) ).build(); } RestServiceImpl( final HostRegistry hostRegistry ); @Override Response getHosts();  }
@Test public void testGetHosts() throws Exception { Response response = restService.getHosts(); Set<ResourceHostInfo> hosts = JsonUtil.fromJson( response.getEntity().toString(), new TypeToken<Set<ResourceHostInfoModel>>() {}.getType() ); assertTrue( hosts.contains( JsonUtil.fromJson( INFO_JSON, ResourceHostInfoModel.class ) ) ); }