### Question:
RealmPublicKeyCacheServiceImpl implements RealmPublicKeyCacheService { @Override public String getPublicKeyByRealm(String realm) { String key = generateKey(realm); logger.info("Trying to get public key for realm `{}`", key); return redisTemplate.opsForValue().get(key); } RealmPublicKeyCacheServiceImpl(String keyPattern, RedisTemplate<String, String> redisTemplate); void put(String key, String value); @Override String getPublicKeyByRealm(String realm); @Override Map<String, String> getAllPublicKeys();  }### Answer:
@Test void getPublicKeyByRealm() { String actualPublicKey = publicKeyCacheService.getPublicKeyByRealm(SOME_REALM); assertThat(actualPublicKey, is(datPublicKey)); }
@Test void tryGetNonExistingKey() { String actualPublicKey = publicKeyCacheService.getPublicKeyByRealm("notExistedKey"); assertThat(actualPublicKey, is(nullValue())); }