### Question:
CustomTranslationModelHooks { public void changeActiveState(final DataDefinition customTranslationDD, final Entity customTranslation) { String pluginIdentifier = customTranslation.getStringField(PLUGIN_IDENTIFIER); String translation = customTranslation.getStringField(CUSTOM_TRANSLATION); if (pluginStateResolver.isEnabled(pluginIdentifier)) { customTranslation.setField(ACTIVE, (translation != null)); } }  boolean checkIfCustomTranslationIsUnique(final DataDefinition customTranslationDD, final Entity customTranslation); void changeActiveState(final DataDefinition customTranslationDD, final Entity customTranslation); void updateCache(final DataDefinition customTranslationDD, final Entity customTranslation);  }### Answer:
@Test public void shouldntChangeActiveStateIfPluginIsntEnabled() { String plugin = "plugin"; given(customTranslation.getStringField(PLUGIN_IDENTIFIER)).willReturn(plugin); given(customTranslation.getStringField(CUSTOM_TRANSLATION)).willReturn(null); given(pluginStateResolver.isEnabled(plugin)).willReturn(false); customTranslationModelHooks.changeActiveState(customTranslationDD, customTranslation); verify(customTranslation, never()).setField(Mockito.anyString(), Mockito.any()); }
@Test public void shouldChangeActiveStateIfPluginIsEnabledAndCustomTranslationIsNull() { String plugin = "plugin"; given(customTranslation.getStringField(PLUGIN_IDENTIFIER)).willReturn(plugin); given(customTranslation.getStringField(CUSTOM_TRANSLATION)).willReturn(null); given(pluginStateResolver.isEnabled(plugin)).willReturn(true); customTranslationModelHooks.changeActiveState(customTranslationDD, customTranslation); verify(customTranslation).setField(ACTIVE, false); }
@Test public void shouldChangeActiveStateIfPluginIsEnabledAndCustomTranslationIsntNull() { String plugin = "plugin"; String translation = "translation"; given(customTranslation.getStringField(PLUGIN_IDENTIFIER)).willReturn(plugin); given(customTranslation.getStringField(CUSTOM_TRANSLATION)).willReturn(translation); given(pluginStateResolver.isEnabled(plugin)).willReturn(true); customTranslationModelHooks.changeActiveState(customTranslationDD, customTranslation); verify(customTranslation).setField(ACTIVE, true); }