@Test public void shouldReturnFalseWhenIsCustomTranslationActiveIfContainsKeyAndContainsLocaleAndCustomTranslationIsNull() { String key = "key"; String locale = "pl"; given(customTranslations.containsKey(key)).willReturn(true); given(customTranslations.get(key)).willReturn(localeAndCustomTranslation); given(localeAndCustomTranslation.containsKey(locale)).willReturn(true); given(localeAndCustomTranslation.get(locale)).willReturn(null); boolean result = customTranslationCacheService.isCustomTranslationActive(key, locale); assertFalse(result); }
@Override public boolean isCustomTranslationActive(final String key, final String locale) { if (getTenantCustomTranslationsCache().containsKey(key) && getTenantCustomTranslationsCache().get(key).containsKey(locale)) { return getTenantCustomTranslationsCache().get(key).get(locale) != null; } return false; }
CustomTranslationCacheServiceImpl implements CustomTranslationCacheService { @Override public boolean isCustomTranslationActive(final String key, final String locale) { if (getTenantCustomTranslationsCache().containsKey(key) && getTenantCustomTranslationsCache().get(key).containsKey(locale)) { return getTenantCustomTranslationsCache().get(key).get(locale) != null; } return false; } }
CustomTranslationCacheServiceImpl implements CustomTranslationCacheService { @Override public boolean isCustomTranslationActive(final String key, final String locale) { if (getTenantCustomTranslationsCache().containsKey(key) && getTenantCustomTranslationsCache().get(key).containsKey(locale)) { return getTenantCustomTranslationsCache().get(key).get(locale) != null; } return false; } CustomTranslationCacheServiceImpl(); }
CustomTranslationCacheServiceImpl implements CustomTranslationCacheService { @Override public boolean isCustomTranslationActive(final String key, final String locale) { if (getTenantCustomTranslationsCache().containsKey(key) && getTenantCustomTranslationsCache().get(key).containsKey(locale)) { return getTenantCustomTranslationsCache().get(key).get(locale) != null; } return false; } CustomTranslationCacheServiceImpl(); @Override void addCustomTranslation(final String key, final String locale, final String customTranslation); @Override void updateCustomTranslation(final String key, final String locale, final String customTranslation); @Override void manageCustomTranslation(final String key, final String locale, final String customTranslation); @Override void removeCustomTranslations(final List<String> keys); @Override String getCustomTranslation(final String key, final String locale); @Override Map<String, Map<String, String>> getCustomTranslations(); @Override boolean isCustomTranslationAdded(final String key); @Override boolean isCustomTranslationActive(final String key, final String locale); @Override void loadCustomTranslations(final List<Entity> customTranslations); }
CustomTranslationCacheServiceImpl implements CustomTranslationCacheService { @Override public boolean isCustomTranslationActive(final String key, final String locale) { if (getTenantCustomTranslationsCache().containsKey(key) && getTenantCustomTranslationsCache().get(key).containsKey(locale)) { return getTenantCustomTranslationsCache().get(key).get(locale) != null; } return false; } CustomTranslationCacheServiceImpl(); @Override void addCustomTranslation(final String key, final String locale, final String customTranslation); @Override void updateCustomTranslation(final String key, final String locale, final String customTranslation); @Override void manageCustomTranslation(final String key, final String locale, final String customTranslation); @Override void removeCustomTranslations(final List<String> keys); @Override String getCustomTranslation(final String key, final String locale); @Override Map<String, Map<String, String>> getCustomTranslations(); @Override boolean isCustomTranslationAdded(final String key); @Override boolean isCustomTranslationActive(final String key, final String locale); @Override void loadCustomTranslations(final List<Entity> customTranslations);  }