예제 #1
0
  @Test
  public void quantityDefautValue() throws Exception {
    // Before Test
    invoiceProducts = sampleProduct01.getInvoiceProducts();
    invoiceProducts.getErrors().empty();
    String statusValue = "1";

    InvoiceProduct invoiceProduct01 =
        invoiceProducts.createInvoiceProduct(sampleInvoice01, sampleProduct01, price);

    assertTrue(invoiceProduct01.getQuantity().equals(statusValue));
    assertTrue(invoiceProducts.getErrors().isEmpty());

    // After Tests
    for (InvoiceProduct invoiceProduct : invoiceProducts.getList()) {
      invoiceProducts.remove(invoiceProduct);
    }
  }
예제 #2
0
  @Test
  public void invoiceProductEquality() throws Exception {
    // Before Tests
    invoiceProducts = sampleProduct01.getInvoiceProducts();
    invoiceProducts.getErrors().empty();

    InvoiceProduct invoiceProduct01 =
        invoiceProducts.createInvoiceProduct(sampleInvoice01, sampleProduct01, price);
    InvoiceProduct invoiceProductCopy = invoiceProduct01.copy();

    assertEquals(invoiceProduct01, invoiceProductCopy);
    assertNotSame(invoiceProduct01, invoiceProductCopy);
    assertTrue(invoiceProducts.getErrors().isEmpty());

    // After Tests
    for (InvoiceProduct invoiceProduct : invoiceProducts.getList()) {
      invoiceProducts.remove(invoiceProduct);
    }
  }
예제 #3
0
  // Products associated with one invoice
  @Test
  public void invoiceProductRequiredCreatedbyInvoice() throws Exception {
    // Before Tests
    invoiceProducts = sampleInvoice01.getInvoiceProducts();
    invoiceProducts.getErrors().empty();

    InvoiceProduct invoiceProduct01 =
        invoiceProducts.createInvoiceProduct(sampleInvoice01, sampleProduct01, price);
    InvoiceProduct invoiceProduct02 =
        invoiceProducts.createInvoiceProduct(sampleInvoice01, sampleProduct02, price);
    InvoiceProduct invoiceProduct03 =
        invoiceProducts.createInvoiceProduct(sampleInvoice01, sampleProduct03, price);

    assertTrue(invoiceProducts.contain(invoiceProduct01));
    assertTrue(invoiceProducts.contain(invoiceProduct02));
    assertTrue(invoiceProducts.contain(invoiceProduct03));
    assertTrue(invoiceProducts.getErrors().isEmpty());

    // After Tests
    for (InvoiceProduct invoiceProduct : invoiceProducts.getList()) {
      invoiceProducts.remove(invoiceProduct);
    }
  }
예제 #4
0
  // InvoiceProduct.price.required=Price is required.
  @Test
  public void priceRequired() throws Exception {
    // Before Test
    invoiceProducts = sampleProduct01.getInvoiceProducts();
    invoiceProducts.getErrors().empty();

    InvoiceProduct invoiceProduct01 =
        invoiceProducts.createInvoiceProduct(sampleInvoice01, sampleProduct01, null);

    assertFalse(invoiceProducts.contain(invoiceProduct01));
    assertNotNull(invoiceProducts.getErrors().getError("InvoiceProduct.price.required"));

    // After Tests
    for (InvoiceProduct invoiceProduct : invoiceProducts.getList()) {
      invoiceProducts.remove(invoiceProduct);
    }
  }
예제 #5
0
  @Test
  public void invoiceProductUpdate() throws Exception {
    // Before Tests
    invoiceProducts = sampleProduct01.getInvoiceProducts();
    invoiceProducts.getErrors().empty();

    InvoiceProduct invoiceProduct01 =
        invoiceProducts.createInvoiceProduct(sampleInvoice01, sampleProduct01, price);
    InvoiceProduct invoiceProductCopy = invoiceProduct01.copy();
    invoiceProductCopy.setProduct(sampleProduct02);

    assertTrue(invoiceProduct01.equals(invoiceProductCopy));
    assertTrue(invoiceProduct01.equalOid(invoiceProductCopy));
    assertFalse(invoiceProduct01.equalProperties(invoiceProductCopy));
    invoiceProducts.update(invoiceProduct01, invoiceProductCopy);
    assertTrue(invoiceProducts.getErrors().isEmpty());

    // After Tests
    for (InvoiceProduct invoiceProduct : invoiceProducts.getList()) {
      invoiceProducts.remove(invoiceProduct);
    }
  }