FileDocCategorySizeDatePackage
TestJMSQueue.javaAPI DocExample1302Mon Apr 25 16:38:54 BST 2005None

TestJMSQueue

public class TestJMSQueue extends TestCase

Fields Summary
private org.springframework.context.ApplicationContext
ctx
private com.springbook.RentABike
store
Constructors Summary
Methods Summary
public voidsetUp()

      ctx = new FileSystemXmlApplicationContext("war/WEB-INF/rentaBikeApp-servlet.xml");
      store = (RentABike)ctx.getBean("rentaBike");

   
public voidtestAddReservation()

      Bike bike = store.getBike(1);
      Customer customer = store.getCustomer(1);

      Reservation reservation = new Reservation(-1, bike, customer, new Date());

      store.addReservation(reservation, 100.00);

   
public voidtestGetBikesFromQueue()

      Bike b = store.getNewBikeFromQueue();
      assertEquals("Ventana", b.getManufacturer());
      assertEquals("El Chamuco", b.getModel());
      b = store.getNewBikeFromQueue();
      assertEquals("Ventana", b.getManufacturer());
      assertEquals("La Bruja", b.getModel());
      b = store.getNewBikeFromQueue();
      assertNull(b);