### Question:
CustomTranslationsListListeners { public void cleanCustomTranslations(final ViewDefinitionState view, final ComponentState state, final String[] args) { GridComponent customTranslationsGrid = (GridComponent) view.getComponentByReference(QcadooViewConstants.L_GRID); List<Entity> customTranslations = customTranslationsGrid.getSelectedEntities(); if (!customTranslations.isEmpty()) { for (Entity customTranslation : customTranslations) { customTranslation.setField(CUSTOM_TRANSLATION, null); customTranslation.getDataDefinition().save(customTranslation); } customTranslationsGrid .addMessage("qcadooCustomTranslations.customTranslationsList.message.cleanCustomTranslationsSuccess", MessageType.SUCCESS); } }  void cleanCustomTranslations(final ViewDefinitionState view, final ComponentState state, final String[] args); void replaceCustomTranslations(final ViewDefinitionState view, final ComponentState state, final String[] args);  }### Answer:
@Test public void shouldCleanCustomTranslationsWhenCustomTranslationIsSelected() { customTranslations = mockEntityList(Arrays.asList(customTranslation)); given(view.getComponentByReference(QcadooViewConstants.L_GRID)).willReturn(customTranslationsGrid); given(customTranslationsGrid.getSelectedEntities()).willReturn(customTranslations); given(customTranslation.getDataDefinition()).willReturn(customTranslationDD); customTranslationsListListeners.cleanCustomTranslations(view, null, null); verify(customTranslation).setField(Mockito.anyString(), Mockito.any()); verify(customTranslationDD).save(Mockito.any(Entity.class)); verify(customTranslationsGrid).addMessage(Mockito.anyString(), Mockito.any(MessageType.class)); }
@Test public void shouldntCleanCustomTranslationsWhenCustomTranslationIsntSelected() { customTranslations = mockEntityList(new ArrayList<Entity>()); given(view.getComponentByReference(QcadooViewConstants.L_GRID)).willReturn(customTranslationsGrid); given(customTranslationsGrid.getSelectedEntities()).willReturn(customTranslations); customTranslationsListListeners.cleanCustomTranslations(view, null, null); verify(customTranslation, never()).setField(Mockito.anyString(), Mockito.any()); verify(customTranslationDD, never()).save(Mockito.any(Entity.class)); verify(customTranslationsGrid, never()).addMessage(Mockito.anyString(), Mockito.any(MessageType.class)); }