コード例 #1
0
  @Test
  public void fixtureNextInvoices() {
    List<Invoice> invoices = Fixture.from(Invoice.class).gimme(3, "nextInvoices");
    assertNotNull("Invoice list should not be null", invoices);
    assertTrue("Invoice list should not be empty", !invoices.isEmpty());

    Calendar calendar = DateTimeUtil.toCalendar("2011-04-30", new SimpleDateFormat("yyyy-MM-dd"));

    for (Invoice invoice : invoices) {
      assertEquals("Calendar should be equal", calendar, invoice.getDueDate());
      calendar.add(Calendar.DAY_OF_MONTH, 1);
    }
  }
コード例 #2
0
  @Test
  public void fixturePreviousInvoices() {
    List<Invoice> invoices = Fixture.from(Invoice.class).gimme(3, "previousInvoices");
    assertNotNull("Invoice list should not be null", invoices);
    assertTrue("Invoice list should not be empty", !invoices.isEmpty());

    Calendar calendar = DateTimeUtil.toCalendar("2011-04-01", new SimpleDateFormat("yyyy-MM-dd"));

    for (Invoice invoice : invoices) {
      assertEquals("Calendar should be equal", calendar, invoice.getDueDate());
      calendar.add(Calendar.MONTH, -1);
      assertTrue(
          "Invoice ammout should be within range",
          invoice.getAmmount().compareTo(new BigDecimal("45.89")) >= 0
              && invoice.getAmmount().compareTo(new BigDecimal("58.67")) <= 0);
    }
  }
コード例 #3
0
 @Test
 public void fixtureInvoice() {
   Invoice invoice = Fixture.from(Invoice.class).gimme("valid");
   assertNotNull("Invoice should not be null", invoice);
   assertEquals("Invoice ammout should have precision of 2", 2, invoice.getAmmount().precision());
 }