@Test public void testGetStringAttributionDev() { String id = "dev"; Response response = backendResource.getStringAttribution(id); assertThat(response.getStatus()) .isEqualTo(Response.Status.OK.getStatusCode()); assertThat(response.getEntity().toString()).isEqualTo(DEV_ATTRIBUTION_STRING); }
@Override public Response getStringAttribution(String id) { Optional<APIResponse> response = validateId(id); if (response.isPresent()) { return Response.status(response.get().getStatus()) .entity(response.get()) .type(MediaType.APPLICATION_JSON_TYPE).build(); } BackendID backendID = BackendID.fromString(id); String attr; switch (backendID) { case MS: attr = MS_ATTRIBUTION_STRING; break; case GOOGLE: attr = GOOGLE_ATTRIBUTION_STRING; break; case DEV: default: attr = DEV_ATTRIBUTION_STRING; break; } return Response.ok(attr).build(); }
BackendResourceImpl implements BackendResource { @Override public Response getStringAttribution(String id) { Optional<APIResponse> response = validateId(id); if (response.isPresent()) { return Response.status(response.get().getStatus()) .entity(response.get()) .type(MediaType.APPLICATION_JSON_TYPE).build(); } BackendID backendID = BackendID.fromString(id); String attr; switch (backendID) { case MS: attr = MS_ATTRIBUTION_STRING; break; case GOOGLE: attr = GOOGLE_ATTRIBUTION_STRING; break; case DEV: default: attr = DEV_ATTRIBUTION_STRING; break; } return Response.ok(attr).build(); } }
BackendResourceImpl implements BackendResource { @Override public Response getStringAttribution(String id) { Optional<APIResponse> response = validateId(id); if (response.isPresent()) { return Response.status(response.get().getStatus()) .entity(response.get()) .type(MediaType.APPLICATION_JSON_TYPE).build(); } BackendID backendID = BackendID.fromString(id); String attr; switch (backendID) { case MS: attr = MS_ATTRIBUTION_STRING; break; case GOOGLE: attr = GOOGLE_ATTRIBUTION_STRING; break; case DEV: default: attr = DEV_ATTRIBUTION_STRING; break; } return Response.ok(attr).build(); } @SuppressWarnings("unused")  BackendResourceImpl(); @Inject  BackendResourceImpl(@BackEndProviders Set<BackendID> availableProviders); }
BackendResourceImpl implements BackendResource { @Override public Response getStringAttribution(String id) { Optional<APIResponse> response = validateId(id); if (response.isPresent()) { return Response.status(response.get().getStatus()) .entity(response.get()) .type(MediaType.APPLICATION_JSON_TYPE).build(); } BackendID backendID = BackendID.fromString(id); String attr; switch (backendID) { case MS: attr = MS_ATTRIBUTION_STRING; break; case GOOGLE: attr = GOOGLE_ATTRIBUTION_STRING; break; case DEV: default: attr = DEV_ATTRIBUTION_STRING; break; } return Response.ok(attr).build(); } @SuppressWarnings("unused")  BackendResourceImpl(); @Inject  BackendResourceImpl(@BackEndProviders Set<BackendID> availableProviders); @Override Response getAttribution(@QueryParam("id") String id); @Override Response getStringAttribution(String id); @Override Response getAvailableBackends(); }
BackendResourceImpl implements BackendResource { @Override public Response getStringAttribution(String id) { Optional<APIResponse> response = validateId(id); if (response.isPresent()) { return Response.status(response.get().getStatus()) .entity(response.get()) .type(MediaType.APPLICATION_JSON_TYPE).build(); } BackendID backendID = BackendID.fromString(id); String attr; switch (backendID) { case MS: attr = MS_ATTRIBUTION_STRING; break; case GOOGLE: attr = GOOGLE_ATTRIBUTION_STRING; break; case DEV: default: attr = DEV_ATTRIBUTION_STRING; break; } return Response.ok(attr).build(); } @SuppressWarnings("unused")  BackendResourceImpl(); @Inject  BackendResourceImpl(@BackEndProviders Set<BackendID> availableProviders); @Override Response getAttribution(@QueryParam("id") String id); @Override Response getStringAttribution(String id); @Override Response getAvailableBackends();  }