// TODO add test methods here. // The methods must be annotated with annotation @Test. For example: // @Test public void create() { repo = ctx.getBean(PatientsRepository.class); ContactDetails contact = new ContactDetails.Builder() .cellnumber("0810479280") .email("*****@*****.**") .landLine("0217018556") .postalAddress("Konoha") .build(); Names name = new Names.Builder().firstName("Naruto").lastName("Uzamaki").build(); Demographic demo = new Demographic.Builder().age(45).gender("Male").build(); Patients pat = new Patients.Builder() .contactDetails(contact) .demographic(demo) .illness("Cancer") .names(name) .patientID("P1001") .patientType("Terminal Patient") .roomNo("D5") .treatmentID("T1001") .paymentID("CD1001") .build(); repo.save(pat); Assert.assertNotNull(pat); }
@Test(dependsOnMethods = "read") public void update() { repo = ctx.getBean(PatientsRepository.class); Patients doc = repo.findOne(id); Patients updateDoc = new Patients.Builder().patients(doc).patientID("P1002").build(); repo.save(updateDoc); Patients newDoc = repo.findOne(id); Assert.assertEquals("P1002", newDoc.getPatientID()); }