@Test public void shouldReturnNullWhenGetCustomTranslationIfCustomTranslationIsNull() { String pluginIdentifier = "plugin"; String key = "key"; String locale = "pl"; given(customTranslationDD.find()).willReturn(searchCriteriaBuilder); given(searchCriteriaBuilder.add(Mockito.any(SearchCriterion.class))).willReturn(searchCriteriaBuilder); given(searchCriteriaBuilder.setMaxResults(1)).willReturn(searchCriteriaBuilder); given(searchCriteriaBuilder.uniqueResult()).willReturn(null); Entity result = customTranslationManagementService.getCustomTranslation(pluginIdentifier, key, locale); assertEquals(null, result); }
@Override public Entity getCustomTranslation(final String pluginIdentifier, final String locale, final String key) { return getCustomTranslationDD().find().add(SearchRestrictions.eq(PLUGIN_IDENTIFIER, pluginIdentifier)) .add(SearchRestrictions.eq(LOCALE, locale)).add(SearchRestrictions.eq(KEY, key)).setMaxResults(1).uniqueResult(); }
CustomTranslationManagementServiceImpl implements CustomTranslationManagementService { @Override public Entity getCustomTranslation(final String pluginIdentifier, final String locale, final String key) { return getCustomTranslationDD().find().add(SearchRestrictions.eq(PLUGIN_IDENTIFIER, pluginIdentifier)) .add(SearchRestrictions.eq(LOCALE, locale)).add(SearchRestrictions.eq(KEY, key)).setMaxResults(1).uniqueResult(); } }
CustomTranslationManagementServiceImpl implements CustomTranslationManagementService { @Override public Entity getCustomTranslation(final String pluginIdentifier, final String locale, final String key) { return getCustomTranslationDD().find().add(SearchRestrictions.eq(PLUGIN_IDENTIFIER, pluginIdentifier)) .add(SearchRestrictions.eq(LOCALE, locale)).add(SearchRestrictions.eq(KEY, key)).setMaxResults(1).uniqueResult(); }  }
CustomTranslationManagementServiceImpl implements CustomTranslationManagementService { @Override public Entity getCustomTranslation(final String pluginIdentifier, final String locale, final String key) { return getCustomTranslationDD().find().add(SearchRestrictions.eq(PLUGIN_IDENTIFIER, pluginIdentifier)) .add(SearchRestrictions.eq(LOCALE, locale)).add(SearchRestrictions.eq(KEY, key)).setMaxResults(1).uniqueResult(); }  @Override @Transactional @SuppressWarnings("unchecked") void addCustomTranslations(final String pluginIdentifier, final String locale, final Map<String, String> translations); @Override @Transactional void removeCustomTranslations(final String pluginIdentifier); @Override @Transactional @SuppressWarnings("unchecked") List<String> getCustomTranslationKeys(final String pluginIdentifier); @Override Entity getCustomTranslation(final String pluginIdentifier, final String locale, final String key); @Override List<Entity> getCustomTranslations(final String locale); @Override List<Entity> getCustomTranslations(); @Override DataDefinition getCustomTranslationDD(); }
CustomTranslationManagementServiceImpl implements CustomTranslationManagementService { @Override public Entity getCustomTranslation(final String pluginIdentifier, final String locale, final String key) { return getCustomTranslationDD().find().add(SearchRestrictions.eq(PLUGIN_IDENTIFIER, pluginIdentifier)) .add(SearchRestrictions.eq(LOCALE, locale)).add(SearchRestrictions.eq(KEY, key)).setMaxResults(1).uniqueResult(); }  @Override @Transactional @SuppressWarnings("unchecked") void addCustomTranslations(final String pluginIdentifier, final String locale, final Map<String, String> translations); @Override @Transactional void removeCustomTranslations(final String pluginIdentifier); @Override @Transactional @SuppressWarnings("unchecked") List<String> getCustomTranslationKeys(final String pluginIdentifier); @Override Entity getCustomTranslation(final String pluginIdentifier, final String locale, final String key); @Override List<Entity> getCustomTranslations(final String locale); @Override List<Entity> getCustomTranslations(); @Override DataDefinition getCustomTranslationDD();  }