Esempio n. 1
0
 @Test
 public void TestCreateIncome() {
   boolean result;
   result =
       icInst.createIncome(date, material.getMaterialId(), 0.0, 1.0, user.getUserId(), "testNote");
   assertEquals(true, result);
   result = icInst.createIncome(date, 0, 0.0, 1.0, user.getUserId(), "testNote");
   assertEquals(false, result);
   result = icInst.createIncome(date, material.getMaterialId(), 0.0, 1.0, 0, "testNote");
   assertEquals(false, result);
 }
Esempio n. 2
0
  @Test
  public void TestUpdateIncome() {
    boolean result;

    Income income = null;
    Object[][] temp = icInst.getIncomes();
    if (temp != null && temp.length > 0) {
      for (int i = 0; i < temp.length; i++) {
        if (temp[i][2].equals("testName")
            && temp[i][6].equals("testUsername")
            && temp[i][7].equals("testNote")) {
          income = icInst.getIncomeByID(Integer.parseInt(temp[i][0].toString()));
        }
      }
    }
    if (income == null) fail();

    result =
        icInst.updateIncome(
            income.getIncomeId(),
            date,
            material.getMaterialId(),
            1.0,
            2.0,
            user.getUserId(),
            "testNote");
    assertEquals(true, result);
    result =
        icInst.updateIncome(
            0, date, material.getMaterialId(), 1.0, 2.0, user.getUserId(), "testNote");
    assertEquals(false, result);
    result =
        icInst.updateIncome(income.getIncomeId(), date, 0, 1.0, 2.0, user.getUserId(), "testNote");
    assertEquals(false, result);
    result =
        icInst.updateIncome(
            income.getIncomeId(), date, material.getMaterialId(), 1.0, 2.0, 0, "testNote");
    assertEquals(false, result);
  }