@Test public void updateAccount() { AccountDto accountDto = new AccountDto(); when(accountService.updateAccount(accountDto)).thenReturn(true); Response response = accountResource.updateAccount(accountDto); assertThat(response.getStatus()).isEqualTo(200); }
@ValidatePayload(AccountDto.class) @PUT @CheckRole("admin") public Response updateAccount(AccountDto accountDto) { Boolean updated = tryApplyChange(() -> accountService.updateAccount(accountDto)); if (updated) { return Response.ok().build(); } else { return Response.status(Response.Status.NOT_FOUND).build(); } }
AccountResourceImpl { @ValidatePayload(AccountDto.class) @PUT @CheckRole("admin") public Response updateAccount(AccountDto accountDto) { Boolean updated = tryApplyChange(() -> accountService.updateAccount(accountDto)); if (updated) { return Response.ok().build(); } else { return Response.status(Response.Status.NOT_FOUND).build(); } } }
AccountResourceImpl { @ValidatePayload(AccountDto.class) @PUT @CheckRole("admin") public Response updateAccount(AccountDto accountDto) { Boolean updated = tryApplyChange(() -> accountService.updateAccount(accountDto)); if (updated) { return Response.ok().build(); } else { return Response.status(Response.Status.NOT_FOUND).build(); } } @Inject  AccountResourceImpl(AccountService accountService,
        AuthenticatedAccount authenticatedAccount,
        Event<AccountCreated> accountCreatedEvent); @SuppressWarnings("unused")  AccountResourceImpl(); }
AccountResourceImpl { @ValidatePayload(AccountDto.class) @PUT @CheckRole("admin") public Response updateAccount(AccountDto accountDto) { Boolean updated = tryApplyChange(() -> accountService.updateAccount(accountDto)); if (updated) { return Response.ok().build(); } else { return Response.status(Response.Status.NOT_FOUND).build(); } } @Inject  AccountResourceImpl(AccountService accountService,
        AuthenticatedAccount authenticatedAccount,
        Event<AccountCreated> accountCreatedEvent); @SuppressWarnings("unused")  AccountResourceImpl(); @GET @CheckRole("admin") List<AccountDto> getAllAccounts(@QueryParam("enabledOnly") boolean enabledOnly); @ValidatePayload(AccountDto.class) @POST @CheckRole("admin") Response registerNewAccount(AccountDto accountDto); @ValidatePayload(AccountDto.class) @PUT @CheckRole("admin") Response updateAccount(AccountDto accountDto); @POST @Path("/login") Response login(@HeaderParam("Authorization") String authHeader); @POST @Path("/logout") Response logout(); }
AccountResourceImpl { @ValidatePayload(AccountDto.class) @PUT @CheckRole("admin") public Response updateAccount(AccountDto accountDto) { Boolean updated = tryApplyChange(() -> accountService.updateAccount(accountDto)); if (updated) { return Response.ok().build(); } else { return Response.status(Response.Status.NOT_FOUND).build(); } } @Inject  AccountResourceImpl(AccountService accountService,
        AuthenticatedAccount authenticatedAccount,
        Event<AccountCreated> accountCreatedEvent); @SuppressWarnings("unused")  AccountResourceImpl(); @GET @CheckRole("admin") List<AccountDto> getAllAccounts(@QueryParam("enabledOnly") boolean enabledOnly); @ValidatePayload(AccountDto.class) @POST @CheckRole("admin") Response registerNewAccount(AccountDto accountDto); @ValidatePayload(AccountDto.class) @PUT @CheckRole("admin") Response updateAccount(AccountDto accountDto); @POST @Path("/login") Response login(@HeaderParam("Authorization") String authHeader); @POST @Path("/logout") Response logout(); final static String AUTH_HEADER; }