Source:
<code>public void testMarkComponentsBelongingToDonationAsUnsafeIfContainsPlasma_shouldMarkComponentsAsUnsafe() { Component firstComponent = aComponent().withId(1L) .withComponentType(aComponentType() .thatContainsPlasma() .build()) .build(); Component secondComponent = aComponent().withId(2L) .withComponentType(aComponentType() .build()) .build(); Component thirdComponent = aComponent().withId(2L) .withComponentType(aComponentType() .thatContainsPlasma() .build()) .build(); <START> Component deletedComponent = aComponent().withId(3L).withIsDeleted(true).build(); <END> Donation donation = aDonation() .withId(1L) .withComponents(Arrays.asList(firstComponent, secondComponent, thirdComponent, deletedComponent)) .build(); doAnswer(returnsFirstArg()).when(componentCRUDService).markComponentAsUnsafe( argThat(hasSameStateAsComponent(firstComponent)), eq(ComponentStatusChangeReasonType.TEST_RESULTS_CONTAINS_PLASMA)); componentCRUDService.markComponentsBelongingToDonationAsUnsafeIfContainsPlasma(donation); verify(componentCRUDService).markComponentAsUnsafe(argThat(hasSameStateAsComponent(firstComponent)), eq(ComponentStatusChangeReasonType.TEST_RESULTS_CONTAINS_PLASMA)); verify(componentCRUDService).markComponentAsUnsafe(argThat(hasSameStateAsComponent(thirdComponent)), eq(ComponentStatusChangeReasonType.TEST_RESULTS_CONTAINS_PLASMA)); verify(componentCRUDService, never()).markComponentAsUnsafe(argThat(hasSameStateAsComponent(deletedComponent)), eq(ComponentStatusChangeReasonType.TEST_RESULTS)); }</code><technical_language>more of a test deletedComponent plasma. moment this component excluded for reasons (it's deleted contains plasma) condition is tested</technical_language>

Target:
public void testMarkComponentsBelongingToDonationAsUnsafeIfContainsPlasma_shouldMarkComponentsAsUnsafe() { Component firstComponent = aComponent().withId(1L) .withComponentType(aComponentType() .thatContainsPlasma() .build()) .build(); Component secondComponent = aComponent().withId(2L) .withComponentType(aComponentType() .build()) .build(); Component thirdComponent = aComponent().withId(2L) .withComponentType(aComponentType() .thatContainsPlasma() .build()) .build(); Component deletedComponent = aComponent().withId(3L) .withComponentType(aComponentType() .thatContainsPlasma() .build()) .withIsDeleted(true) .build(); Donation donation = aDonation() .withId(1L) .withComponents(Arrays.asList(firstComponent, secondComponent, thirdComponent, deletedComponent)) .build(); doAnswer(returnsFirstArg()).when(componentCRUDService).markComponentAsUnsafe( argThat(hasSameStateAsComponent(firstComponent)), eq(ComponentStatusChangeReasonType.TEST_RESULTS_CONTAINS_PLASMA)); componentCRUDService.markComponentsBelongingToDonationAsUnsafeIfContainsPlasma(donation); verify(componentCRUDService).markComponentAsUnsafe(argThat(hasSameStateAsComponent(firstComponent)), eq(ComponentStatusChangeReasonType.TEST_RESULTS_CONTAINS_PLASMA)); verify(componentCRUDService, never()).markComponentAsUnsafe(argThat(hasSameStateAsComponent(secondComponent)), eq(ComponentStatusChangeReasonType.TEST_RESULTS_CONTAINS_PLASMA)); verify(componentCRUDService).markComponentAsUnsafe(argThat(hasSameStateAsComponent(thirdComponent)), eq(ComponentStatusChangeReasonType.TEST_RESULTS_CONTAINS_PLASMA)); verify(componentCRUDService, never()).markComponentAsUnsafe(argThat(hasSameStateAsComponent(deletedComponent)), eq(ComponentStatusChangeReasonType.TEST_RESULTS_CONTAINS_PLASMA)); }