Ejemplo n.º 1
0
 @Before
 public void setUp() {
   mapper = new JPABillMapper();
   b = new Bill();
   b.setBegintime(new Date());
   b.setEndtime(new Date());
   b.setTableid(3);
 }
Ejemplo n.º 2
0
  @Test
  public void updateTest() {
    Bill bill = new Bill();
    bill.setBegintime(new Date());
    bill.setEndtime(null);
    bill.setTableid(99);
    mapper.add(bill);
    System.out.println("\n");
    System.out.println("Bill after being add to the db");
    System.out.println(bill);
    System.out.println("\n");
    Bill updatedBill = bill;
    updatedBill.setTableid(69);
    updatedBill.setEndtime(new Date());
    System.out.println("\n");
    System.out.println("Bill after being updated in the db");

    mapper.update(updatedBill);
    System.out.println(updatedBill);
    System.out.println(mapper.getById(bill.getId()));
    System.out.println("\n");
    assertEquals(updatedBill.toString(), mapper.getById(bill.getId()).toString());
  }