// @Test(dependsOnMethods = "update") public void delete() throws Exception { MotorCycle motorCycle = repository.findOne(id); repository.delete(motorCycle); MotorCycle deletedMotorCycle = repository.findOne(id); Assert.assertNull(deletedMotorCycle); }
// @Test(dependsOnMethods = "create") public void read() throws Exception { MotorCycle motorCycle = repository.findOne(id); Assert.assertNotNull(motorCycle); Assert.assertEquals("kawa34er", motorCycle.getSerialNumber()); Assert.assertEquals("Kawasaki", motorCycle.getMake()); }
// @Test public void create() throws Exception { List<PaymentMethod> paymentMethods = new ArrayList(); List<Rental> rentals = new ArrayList(); PaymentMethod paymentMethod = new PaymentMethod.Builder("Credit").Price(4000.00).build(); paymentMethods.add(paymentMethod); Rental rental = new Rental.Builder("22-07-2015") .returnDate("28-07-2015") .paymentMethod(paymentMethods) .build(); rentals.add(rental); MotorCycle motorCycle = MotorCycleFactory.createMotorCycle( "kawa34er", "Kawasaki", "Ninja", "2006", "2000km", "full", "Mint ", "600ccsd", "600cc", "Unleaded ", rentals); repository.save(motorCycle); id = motorCycle.getId(); Assert.assertNotNull(motorCycle.getId()); }