@Test(dependsOnMethods = "read") public void update() throws Exception { // Get Login Login login = service.findById(id); // Change it Login newlogin = new Login.Builder(login.getUserName()).copy(login).name("Garran").build(); // Save it service.update(newlogin); // Get Updated Login Login updatedLogin = service.findById(id); Assert.assertEquals("Garran", updatedLogin.getName()); }
@Test public void create() throws Exception { // Create a Login Class Login login = LoginFactory.createLogin( "Garran", "password", "*****@*****.**", "Active", date, "Garran", "Michaels", "16513513", "21", "Vent Road", "Muizenberg", "WesternCape", "7945"); // Save in the Database service.save(login); // Id Should be available id = login.getId(); Assert.assertNotNull(login); }
@Test(dependsOnMethods = "create") public void read() throws Exception { // Get Login Login login = service.findById(id); Assert.assertEquals("Garran", login.getUserName()); }