### Question:
ConfigurationService { public boolean isDefaultUserAssignedToEntityWithRole() { EUser u = userRepository.findFirstByUsernameOrEmail(dc.getUserAdminDefaultName(), dc.getUserAdminDefaultEmail()); if (u != null) { EOwnedEntity e = entityRepository.findFirstByUsername(dc.getEntityDefaultUsername()); if (e != null) { BRole role = roleRepository.findFirstByLabel(dc.getRoleAdminDefaultLabel()); if (role != null) { com.gms.domain.security.BAuthorization.BAuthorizationPk pk = new BAuthorization.BAuthorizationPk(u.getId(), e.getId(), role.getId()); authRepository.save(new BAuthorization(pk, u, e, role)); return true; } } } return false; } @Autowired  ConfigurationService(final BConfigurationRepository configurationRepository,
                                final EUserRepository userRepository, final EOwnedEntityRepository entityRepository,
                                final BRoleRepository roleRepository, final BAuthorizationRepository authRepository,
                                final DefaultConst defaultConst); boolean isApplicationConfigured(); boolean isDefaultConfigurationCreated(); boolean isDefaultUserAssignedToEntityWithRole(); Map<String, String> getConfig(); Object getConfig(final String key); String getConfig(final String key, final long userId); Map<String, Object> getConfigByUser(final long userId); void saveConfig(final Map<String, Object> configs); void saveConfig(final Map<String, Object> configs, final long userId); void setUserRegistrationAllowed(final boolean userRegistrationAllowed); void setIsMultiEntity(final boolean isMultiEntity); Long getLastAccessedEntityIdByUser(final long userId); void setLastAccessedEntityIdByUser(final long userId, final long entityId); static final String IN_SERVER; static final String CONFIG_NOT_FOUND; }### Answer:
@Test public void assignDefaultUserToEntityWithRole() { final String msg = "Assign default user to entity with role failed"; final boolean ok = configurationService.isDefaultUserAssignedToEntityWithRole(); assertTrue(msg, ok); final EUser u = userRepository.findFirstByUsername(dc.getUserAdminDefaultUsername()); final EOwnedEntity e = entityRepository.findFirstByUsername(dc.getEntityDefaultUsername()); assertNotNull(u); assertNotNull(e); final List<BRole> roles = authRepository.getRolesForUserOverEntity(u.getId(), e.getId()); assertTrue(msg, roles != null && !roles.isEmpty()); }
@Transactional @Test public void assignDefaultUserToEntityWithRoleDefaultUserNotFound() { EUser defaultUser = userRepository.findFirstByUsernameOrEmail(dc.getUserAdminDefaultName(), dc.getUserAdminDefaultEmail()); authRepository.delete(authRepository.findFirstByUserAndEntityNotNullAndRoleEnabled(defaultUser, true)); userRepository.delete(defaultUser); assertFalse(configurationService.isDefaultUserAssignedToEntityWithRole()); }