### Question:
KeycloakRepositoryImpl implements KeycloakRepository { @Override public boolean isEtherAddressVerified(final UserRepresentation userRepresentation) { return "true".equalsIgnoreCase(getAttribute(userRepresentation, ETHER_ADDRESS_VERIFIED_KEY)); } KeycloakRepositoryImpl(RealmResource resource, @Value("${keycloak.auth-server-url}") String keycloakUrl); Stream<UserIdentity> getUserIdentities(String userId); UserRepresentation getUser(String userId); void updateEtherAddress(String userId, String newAddress); @Override void updateEtherAddressVerified(final String userId, final Boolean isVerified); void updateTelegramName(String userId, String telegramName); void updateHeadline(String userId, String headline); void updateVerifiedDeveloper(String userId, Boolean isVerified); @Override boolean isEtherAddressVerified(final UserRepresentation userRepresentation); boolean isVerifiedDeveloper(UserRepresentation userRepresentation); boolean isVerifiedDeveloper(final String userId); String getAttribute(UserRepresentation userRepresentation, String property); String getTelegramName(UserRepresentation userRepresentation); String getPicture(UserRepresentation userRepresentation); String getHeadline(UserRepresentation userRepresentation); String getAccessToken(@NonNull KeycloakAuthenticationToken token, @NonNull Provider provider); boolean userExists(String userId);  }### Answer:
@Test public void isVerifiedEtherAddress_attribute_not_present() { final UserRepresentation userRepresentation = mock(UserRepresentation.class); final Map<String, List<String>> userAttributes = new HashMap<>(); userAttributes.put("djghfh", new ArrayList<>()); when(userRepresentation.getAttributes()).thenReturn(userAttributes); final boolean result = keycloakRepository.isEtherAddressVerified(userRepresentation); assertThat(result).isFalse(); }
@Test public void isVerifiedEtherAddress_attributes_empty() { final UserRepresentation userRepresentation = mock(UserRepresentation.class); final Map<String, List<String>> userAttributes = new HashMap<>(); when(userRepresentation.getAttributes()).thenReturn(userAttributes); final boolean result = keycloakRepository.isEtherAddressVerified(userRepresentation); assertThat(result).isFalse(); }
@Test public void isVerifiedEtherAddress_attributes_null() { final UserRepresentation userRepresentation = mock(UserRepresentation.class); final Map<String, List<String>> userAttributes = null; when(userRepresentation.getAttributes()).thenReturn(userAttributes); final boolean result = keycloakRepository.isEtherAddressVerified(userRepresentation); assertThat(result).isFalse(); }