Methods Summary |
---|
public void | setUp()
ctx = new FileSystemXmlApplicationContext("/war/WEB-INF/rentaBikeApp-servlet.xml");
store = (RentABike)ctx.getBean("RentABike");
|
public void | testAddBike()
Bike bike = new Bike(-1, "MyMan", "MyBike", 12, "12312312", 12.00, "New");
store.saveBike(bike);
bike = store.getBike("12312312");
assertNotNull(bike);
assertEquals("MyMan", bike.getManufacturer());
store.deleteBike(bike);
List bikes = store.getBikes();
assertEquals(3, bikes.size());
|
public void | testAddCustomer()
Customer c = new Customer(-1, "Roger", "Clemons");
store.saveCustomer(c);
store.deleteCustomer(c);
|
public void | testAddRes()
Reservation newres = new Reservation(-1, store.getBike(1), store.getCustomer(2), new Date());
try {
store.addReservation(newres, 120.00);
} catch (AddReservationException are) {
System.out.println("Error. Rolling back tx.");
}
|
public void | testCustomer()
Customer c = store.getCustomer(1);
assertNotNull(c);
assertEquals("Justin", c.getFirstName());
|
public void | testDate()
List l = store.getReservations(new Date(Date.parse("9/15/2004")));
assertNotNull(l);
assertTrue(0<l.size());
|
public void | testGetBike()
Bike bike = store.getBike(2);
assertNotNull(bike);
assertEquals("Cannondale", bike.getManufacturer());
assertNotNull(bike.getReservations());
assertTrue(0<bike.getReservations().size());
|
public void | testGetBikes()
List bikes = store.getBikes();
assertNotNull(bikes);
assertTrue(bikes.size() > 0);
|
public void | testReservation()
Reservation r = store.getReservation(1);
assertNotNull(r);
assertNotNull(r.getBike());
assertNotNull(r.getCustomer());
|