### Question:
UserRoleResource { @GET public Response getRoles(@Auth UserInfo userInfo) { log.debug("Getting all roles for admin {}...", userInfo.getName()); return Response.ok(userRoleService.getUserRoles()).build(); } @Inject  UserRoleResource(UserRoleService roleService); @GET Response getRoles(@Auth UserInfo userInfo); @POST Response createRole(@Auth UserInfo userInfo, UserRoleDto dto);  }### Answer:
@Test public void getRoles() { when(rolesService.getUserRoles()).thenReturn(Collections.singletonList(getUserRole())); final Response response = resources.getJerseyTest() .target("/role") .request() .header("Authorization", "Bearer " + TOKEN) .get(); final List<UserRoleDto> actualRoles = response.readEntity(new GenericType<List<UserRoleDto>>() { }); assertEquals(HttpStatus.SC_OK, response.getStatus()); assertEquals(ROLE_ID, actualRoles.get(0).getId()); assertEquals(MediaType.APPLICATION_JSON, response.getHeaderString(HttpHeaders.CONTENT_TYPE)); verify(rolesService).getUserRoles(); verifyNoMoreInteractions(rolesService); }