/** Méthode de test Get. */ @Test public void get() { final Inclusion patient = new Inclusion(); patient.setId(1L); Mockito.when(this.entityManager.find(Inclusion.class, patient.getId())).thenReturn(patient); final Inclusion patientReturned = this.patientDao.get(patient.getId()); Assert.assertNotNull(patientReturned); Assert.assertNotNull(patientReturned.getId()); Assert.assertEquals(1L, patientReturned.getId().longValue()); }
/** Méthode de test Delete. */ @Test public void delete() { final Inclusion patient = new Inclusion(); Mockito.when(this.patientDao.get(patient.getId())).thenReturn(patient); this.patientDao.remove(patient); Mockito.verify(this.entityManager, Mockito.times(1)).remove(Matchers.any()); }