@Test public void test_should_override_to_citizen_role() { User user = User.builder() .id(1L) .type(UserType.CITIZEN) .roles(Collections.singleton(Role.builder().code("ADMIN").build())) .build(); user.setRoleToCitizen(); assertEquals(UserType.CITIZEN, user.getType()); final Set<Role> roles = user.getRoles(); assertEquals(1, roles.size()); assertEquals("CITIZEN", roles.iterator().next().getCode()); }
public void setRoleToCitizen() { type = UserType.CITIZEN; roles = Collections.singleton(Role.getCitizenRole()); }
User { public void setRoleToCitizen() { type = UserType.CITIZEN; roles = Collections.singleton(Role.getCitizenRole()); } }
User { public void setRoleToCitizen() { type = UserType.CITIZEN; roles = Collections.singleton(Role.getCitizenRole()); }  }
User { public void setRoleToCitizen() { type = UserType.CITIZEN; roles = Collections.singleton(Role.getCitizenRole()); }  User addAddressItem(Address addressItem); User addRolesItem(Role roleItem); void validateNewUser(); void validateUserModification(); boolean isCorrespondenceAddressInvalid(); boolean isPermanentAddressInvalid(); boolean isOtpReferenceAbsent(); boolean isTypeAbsent(); boolean isActiveIndicatorAbsent(); boolean isMobileNumberAbsent(); boolean isNameAbsent(); boolean isUsernameAbsent(); boolean isTenantIdAbsent(); boolean isPasswordAbsent(); boolean isRolesAbsent(); boolean isIdAbsent(); void nullifySensitiveFields(); boolean isLoggedInUserDifferentFromUpdatedUser(); void setRoleToCitizen(); void updatePassword(String newPassword); OtpValidationRequest getOtpValidationRequest(); List<Address> getPermanentAndCorrespondenceAddresses(); void setDefaultPasswordExpiry(int expiryInDays); void setActive(boolean isActive); }
User { public void setRoleToCitizen() { type = UserType.CITIZEN; roles = Collections.singleton(Role.getCitizenRole()); }  User addAddressItem(Address addressItem); User addRolesItem(Role roleItem); void validateNewUser(); void validateUserModification(); boolean isCorrespondenceAddressInvalid(); boolean isPermanentAddressInvalid(); boolean isOtpReferenceAbsent(); boolean isTypeAbsent(); boolean isActiveIndicatorAbsent(); boolean isMobileNumberAbsent(); boolean isNameAbsent(); boolean isUsernameAbsent(); boolean isTenantIdAbsent(); boolean isPasswordAbsent(); boolean isRolesAbsent(); boolean isIdAbsent(); void nullifySensitiveFields(); boolean isLoggedInUserDifferentFromUpdatedUser(); void setRoleToCitizen(); void updatePassword(String newPassword); OtpValidationRequest getOtpValidationRequest(); List<Address> getPermanentAndCorrespondenceAddresses(); void setDefaultPasswordExpiry(int expiryInDays); void setActive(boolean isActive);  }