### Question:
CustomTranslationModelHooksCTM { public void updateCustomTranslationData(final DataDefinition customTranslationDD, final Entity customTranslation) { String pluginIdentifier = customTranslation.getStringField(PLUGIN_IDENTIFIER); customTranslation.setField(PLUGIN_NAME, getPluginName(pluginIdentifier)); }  void updateCustomTranslationData(final DataDefinition customTranslationDD, final Entity customTranslation);  }### Answer:
@Test public void shouldUpdateCustomTranslationDataWhenDataIsNull() { given(customTranslation.getStringField(PLUGIN_IDENTIFIER)).willReturn(null); given(customTranslation.getStringField(KEY)).willReturn(null); given(customTranslation.getStringField(LOCALE)).willReturn(null); customTranslationModelHooksCTM.updateCustomTranslationData(customTranslationDD, customTranslation); verify(customTranslation).setField(PLUGIN_NAME, null); verify(customTranslation).setField(PROPERTIES_TRANSLATION, null); }
@Test public void shouldUpdateCustomTranslationDataWhenDataIsntNull() { String pluginIdentifier = "plugin"; String key = "key"; String locale = "pl"; String pluginName = "plugin"; String propertiesTranslation = "translation"; given(customTranslation.getStringField(PLUGIN_IDENTIFIER)).willReturn(pluginIdentifier); given(customTranslation.getStringField(KEY)).willReturn(key); given(customTranslation.getStringField(LOCALE)).willReturn(locale); given(pluginAccessor.getPlugin(pluginIdentifier)).willReturn(plugin); given(plugin.getPluginInformation()).willReturn(pluginInformation); given(pluginInformation.getName()).willReturn(pluginName); given(translationService.translate(key, new Locale(locale))).willReturn(propertiesTranslation); customTranslationModelHooksCTM.updateCustomTranslationData(customTranslationDD, customTranslation); verify(customTranslation).setField(PLUGIN_NAME, pluginName); verify(customTranslation).setField(PROPERTIES_TRANSLATION, propertiesTranslation); }