TranslationKitStep extends BasePipelineStep { @Override protected Event handleEndDocument(Event event) { translationKitService.updateTranslationKitWithTmTextUnits(translationKitId, translationKitTextUnits, wordCount); return event; } TranslationKitStep(Long translationKitId); @Override String getName(); @Override String getDescription();  }
@Test public void testHandleEndDocument() { logger.debug("Ids for entities worked on"); Long translationKitId = 987654321L; logger.debug("State of the instance to be checked"); List<TranslationKitTextUnit> translationKitTextUnits = new ArrayList<>(); logger.debug("Create mocks"); TranslationKitService mockTranslationKitService = mock(TranslationKitService.class); logger.debug("Create instance to be tested, inject mocks and state"); TranslationKitStep translationKitStep = new TranslationKitStep(translationKitId); translationKitStep.translationKitService = mockTranslationKitService; translationKitStep.translationKitTextUnits = translationKitTextUnits; logger.debug("Build test input"); Event event = new Event(EventType.END_DOCUMENT); logger.debug("Test and assert"); Event result = translationKitStep.handleEndDocument(event); assertEquals("the input event should be returned", event, result); verify(mockTranslationKitService).updateTranslationKitWithTmTextUnits(translationKitId, translationKitTextUnits, 0L); }