UserService { public User findSystemUser() { return userRepository.findByUsername(SYSTEM_USERNAME); }  User createUserWithRole(String username, String password, Role role, String givenName, String surname, String commonName, boolean partiallyCreated); @Transactional User saveUserWithRole(User user, String password, Role role, String givenName, String surname, String commonName, boolean partiallyCreated); User createUserWithRole(String username, String password, Role role); String createAuthorityName(Role role); User findSystemUser(); @Transactional void updateCreatedByUserToSystemUser(User userToUpdate); @Transactional void deleteUser(User user); User createBasicUser(String username, String givenName, String surname, String commonName, boolean partiallyCreated); User createOrUpdateBasicUser(User user, String username, String givenName, String surname, String commonName); User getOrCreatePartialBasicUser(String username); User getOrCreateOrUpdateBasicUser(String username, String givenName, String surname, String commonName); static final String SYSTEM_USERNAME; }
@Test public void testSystemUserExist() { User systemUser = userService.findSystemUser(); assertNotNull("System user should always been created.", systemUser); assertNotNull("System user has a createdByUser", systemUser.getCreatedByUser()); assertFalse("System user should be disabled", systemUser.getEnabled()); }