/** Junit test case to test treatement application to a student entity. */ @Test public void testApplyAll() { Entity student = Mockito.mock(Entity.class); applicator.apply(student); Mockito.verify(treatment1, Mockito.atLeast(1)).apply(Mockito.any(Entity.class)); Mockito.verify(treatment2, Mockito.atLeast(1)).apply(Mockito.any(Entity.class)); }
/** * Runs before JUnit test and does the initiation work. * * @throws IOException if an I/O error occurred */ @Before public void init() throws IOException { List<Treatment> treatments = new ArrayList<Treatment>(); Entity student = Mockito.mock(Entity.class); Mockito.when(treatment1.apply(Mockito.any(Entity.class))).thenReturn(student); treatments.add(treatment1); Mockito.when(treatment2.apply(Mockito.any(Entity.class))).thenReturn(student); treatments.add(treatment2); applicator.setTreatments(treatments); }