// TODO add test methods here. // The methods must be annotated with annotation @Test. For example: // @Test public void createRegionOffice() { repo = ctx.getBean(RegionOfficeRepository.class); // region Branches Details // Address address = new Address.Builder("l68 n3").street("septa").suburb("epping // industry1") // .city("Cape Town").province("Western Cape").postalCode("5465").build(); // // Contact cs = new // Contact.Builder("0215646").phone("021546865").email("*****@*****.**").build(); // // List<Branch> branch = new ArrayList<>(); // branch.add(new Branch.Builder("Cape // Town").address(address).contact(cs).branchYearToDateSales(20).build()); // branch.add(new Branch.Builder("Port // arlfred").address(address).contact(cs).branchYearToDateSales(20).build()); // //region office info // Address regionAddress = new Address.Builder("452").street("Evenue // Road").city("PE").province("EC") // .postalCode("7525").build(); // Contact contact = new Contact.Builder("0215648").phone("021 564 // 6835").email("*****@*****.**").build(); RegionOffice office = new RegionOffice.Builder("EC8085").officeName("VW_Southern Africa").build(); repo.save(office); id = office.getId(); Assert.assertNotNull(office); }
@Test(dependsOnMethods = "readRegionOffice") public void updateRegionOffice() { repo = ctx.getBean(RegionOfficeRepository.class); RegionOffice office = repo.findOne(id); // updating RegionOffice updateOffice = new RegionOffice.Builder("EC8085") .regionOffice(office) .officeName("Southern Afriva VW") .build(); repo.save(updateOffice); Assert.assertEquals(updateOffice.getOfficeName(), "Southern Afriva VW"); }
@Test(dependsOnMethods = "createRegionOffice") public void readRegionOffice() { repo = ctx.getBean(RegionOfficeRepository.class); RegionOffice office = repo.findOne(id); Assert.assertEquals(office.getOfficeName(), "VW_Southern Africa"); }