@Test void register() { when(adminRestClient.register(any())).thenReturn(ResponseEntity.created(URI.create("")).build()); when(userMapper.toUserTO(any())).thenAnswer(a -> Mappers.getMapper(UserMapper.class).toUserTO(a.getArgument(0))); User request = new User(); request.setUserRoles(Collections.singletonList(UserRole.CUSTOMER)); ResponseEntity<Void> result = controller.register(request, "TPP"); assertEquals(HttpStatus.CREATED, result.getStatusCode()); }
@Override public ResponseEntity<Void> register(User user, String tppId) { UserTO userTO = userMapper.toUserTO(user); if (userTO.getUserRoles().contains(UserRoleTO.CUSTOMER)) { userTO.setBranch(tppId); } adminRestClient.register(userTO); return ResponseEntity.status(CREATED).build(); }
TppAdminController implements TppAdminRestApi { @Override public ResponseEntity<Void> register(User user, String tppId) { UserTO userTO = userMapper.toUserTO(user); if (userTO.getUserRoles().contains(UserRoleTO.CUSTOMER)) { userTO.setBranch(tppId); } adminRestClient.register(userTO); return ResponseEntity.status(CREATED).build(); } }
TppAdminController implements TppAdminRestApi { @Override public ResponseEntity<Void> register(User user, String tppId) { UserTO userTO = userMapper.toUserTO(user); if (userTO.getUserRoles().contains(UserRoleTO.CUSTOMER)) { userTO.setBranch(tppId); } adminRestClient.register(userTO); return ResponseEntity.status(CREATED).build(); }  }
TppAdminController implements TppAdminRestApi { @Override public ResponseEntity<Void> register(User user, String tppId) { UserTO userTO = userMapper.toUserTO(user); if (userTO.getUserRoles().contains(UserRoleTO.CUSTOMER)) { userTO.setBranch(tppId); } adminRestClient.register(userTO); return ResponseEntity.status(CREATED).build(); }  @Override ResponseEntity<CustomPageImpl<UserExtendedTO>> users(String countryCode, String tppId, String tppLogin, String userLogin, UserRoleTO role, Boolean blocked, int page, int size); @Override ResponseEntity<Void> user(UserTO user); @Override ResponseEntity<CustomPageImpl<AccountDetailsExtendedTO>> accounts(String countryCode, String tppId, String tppLogin, String ibanParam, Boolean isBlocked, int page, int size); @Override ResponseEntity<Void> register(User user, String tppId); @Override ResponseEntity<Void> admin(User user); @Override ResponseEntity<CustomPageImpl<UserTO>> admins(int page, int size); @Override ResponseEntity<Void> remove(String tppId); @Override ResponseEntity<Void> updatePassword(String tppId, String password); @Override ResponseEntity<Boolean> changeStatus(String userId); }
TppAdminController implements TppAdminRestApi { @Override public ResponseEntity<Void> register(User user, String tppId) { UserTO userTO = userMapper.toUserTO(user); if (userTO.getUserRoles().contains(UserRoleTO.CUSTOMER)) { userTO.setBranch(tppId); } adminRestClient.register(userTO); return ResponseEntity.status(CREATED).build(); }  @Override ResponseEntity<CustomPageImpl<UserExtendedTO>> users(String countryCode, String tppId, String tppLogin, String userLogin, UserRoleTO role, Boolean blocked, int page, int size); @Override ResponseEntity<Void> user(UserTO user); @Override ResponseEntity<CustomPageImpl<AccountDetailsExtendedTO>> accounts(String countryCode, String tppId, String tppLogin, String ibanParam, Boolean isBlocked, int page, int size); @Override ResponseEntity<Void> register(User user, String tppId); @Override ResponseEntity<Void> admin(User user); @Override ResponseEntity<CustomPageImpl<UserTO>> admins(int page, int size); @Override ResponseEntity<Void> remove(String tppId); @Override ResponseEntity<Void> updatePassword(String tppId, String password); @Override ResponseEntity<Boolean> changeStatus(String userId);  }