Пример #1
0
 @GET
 @NoAuthorization
 public Response get() {
   return Response.ok()
       .entity(Dtos.asDto(subjectProfileService.getProfile(getPrincipal())))
       .build();
 }
 @Bean
 public SubjectProfileService subjectProfileService() {
   SubjectProfileService subjectProfileService =
       EasyMock.createMock(SubjectProfileService.class);
   expect(subjectProfileService.getProfile("user1"))
       .andReturn(new SubjectProfile("user1", OpalUserRealm.OPAL_REALM))
       .anyTimes();
   expect(subjectProfileService.getProfile("app1"))
       .andReturn(new SubjectProfile("app1", ApplicationRealm.APPLICATION_REALM))
       .anyTimes();
   subjectProfileService.ensureProfile("user1", OpalUserRealm.OPAL_REALM);
   expectLastCall().anyTimes();
   subjectProfileService.ensureProfile("app1", ApplicationRealm.APPLICATION_REALM);
   expectLastCall().anyTimes();
   subjectProfileService.deleteProfile("user1");
   expectLastCall().anyTimes();
   subjectProfileService.deleteProfile("app1");
   expectLastCall().anyTimes();
   replay(subjectProfileService);
   return subjectProfileService;
 }