ConfigurationResource extends AbstractResource { @GET @Path("applications/types") @Produces(MediaType.APPLICATION_JSON) public Response getEnabledApplicationTypes() { ApplicationTypesEntity enabledApplicationTypes = applicationTypeService.getEnabledApplicationTypes(); return Response .ok(convert(enabledApplicationTypes)) .build(); }  @GET @Produces(MediaType.APPLICATION_JSON) Response getPortalConfiguration(); @GET @Path("users/custom-fields") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response listCustomUserFields(); @GET @Path("identities") @Produces(MediaType.APPLICATION_JSON) Response getPortalIdentityProviders(@BeanParam PaginationParam paginationParam); @GET @Path("identities/{identityProviderId}") @Produces(MediaType.APPLICATION_JSON) Response getPortalIdentityProvider(@PathParam("identityProviderId") String identityProviderId); @GET @Path("links") @Produces(MediaType.APPLICATION_JSON) Response getPortalLinks(@HeaderParam("Accept-Language") String acceptLang); @GET @Path("applications/types") @Produces(MediaType.APPLICATION_JSON) Response getEnabledApplicationTypes(); @GET @Path("applications/roles") @Produces(MediaType.APPLICATION_JSON) Response getApplicationRoles();  }
@Test public void shouldGetApplicationTypes() throws TechnicalException { resetAllMocks(); ApplicationTypesEntity typesEntity = new ApplicationTypesEntity(); List<ApplicationTypeEntity> data = new ArrayList<>(); ApplicationTypeEntity simple = new ApplicationTypeEntity(); simple.setId("simple"); simple.setAllowed_grant_types(new ArrayList<>()); simple.setDefault_grant_types(new ArrayList<>()); simple.setMandatory_grant_types(new ArrayList<>()); simple.setName("Simple"); simple.setDescription("Simple type"); data.add(simple); ApplicationTypeEntity web = new ApplicationTypeEntity(); web.setId("web"); List<ApplicationGrantTypeEntity> grantTypes = new ArrayList<>(); ApplicationGrantTypeEntity grantType = new ApplicationGrantTypeEntity(); grantType.setName("name"); List<String> responses_types = new ArrayList<>(); responses_types.add("token"); grantType.setResponse_types(responses_types); grantTypes.add(grantType); web.setAllowed_grant_types(grantTypes); web.setDefault_grant_types(new ArrayList<>()); web.setMandatory_grant_types(new ArrayList<>()); web.setName("Web"); web.setDescription("Web type"); data.add(web); typesEntity.setData(data); when(applicationTypeService.getEnabledApplicationTypes()).thenReturn(typesEntity); final Response response = target().path("applications").path("types").request().get(); assertEquals(HttpStatusCode.OK_200, response.getStatus()); final ConfigurationApplicationTypesResponse appTypes = response.readEntity(ConfigurationApplicationTypesResponse.class); assertNotNull(appTypes); @Valid List<ApplicationType> types = appTypes.getData(); assertNotNull(types); assertEquals(2, types.size()); assertEquals("web", types.get(1).getId()); assertEquals(1, types.get(1).getAllowedGrantTypes().size()); }