@AfterClass public static void tearDownClass() throws Exception { 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) income.delete(); if (user != null) user.delete(); if (material != null) material.delete(); if (materialType != null) materialType.delete(); }
@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); }