コード例 #1
0
  @Test
  public void makingAnBillPersistantMakesItFetchable() {
    mapper.add(b);

    Bill read = mapper.getById(b.getId());
    assertEquals("Expected Bill should have the same content", b.getId(), read.getId());
  }
コード例 #2
0
  @Test
  public void makingAnBillPersistantMakesItFetchableFromAnotherMapper() {
    mapper.add(b);

    JPABillMapper anotherMapper = new JPABillMapper();
    Bill read = anotherMapper.getById(b.getId());
    assertEquals("Expected Bill should have the same content", b.getId(), read.getId());
  }
コード例 #3
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());
  }