ServiceResource { @GET @Path("/operations") @Produces(APPLICATION_JSON) public Response getSupportedOperations() { Map<String, Set<OperationType>> supportedOperations = Arrays.stream(CloudType.values()) .filter(ct -> !operationsRegistry.getOperationTypes(ct).isEmpty()) .collect(Collectors.toMap( CloudType::value, operationsRegistry::getOperationTypes )); return ok(supportedOperations); } @Autowired  ServiceResource(Storage storage, OperationsRegistry operationsRegistry); @GET @Path("/ping") Response ping(); @GET @Path("/version") @Produces(TEXT_PLAIN) String getServerVersion(); @GET @Path("/operations") @Produces(APPLICATION_JSON) Response getSupportedOperations();  }
@Test public void testGetSupportedOperations() throws Exception { operationsRegistry.addOperation(MOCK, ADD_IMAGE); Response<Map<CloudType, Set<OperationType>>> response = getApi().getSupportedOperations().execute(); assertThat(response.isSuccessful(), is(true)); assertThat(response.body(), equalTo(Collections.singletonMap(MOCK, Collections.singleton(ADD_IMAGE)))); }