@BeforeClass public static void setUpClass() throws Exception { icInst = IncomeController.getInstance(); date = new Date(); UserController uc = UserController.getInstance(); uc.createUser("testName", "testSurname", "testUsername"); user = uc.getUserByUsername("testUserName"); MaterialTypeController mtc = MaterialTypeController.getInstance(); mtc.createMaterialType("testName", "testNote"); materialType = mtc.getMaterialTypeByName("testName"); MaterialController mc = MaterialController.getInstance(); mc.createMaterial( "testName", materialType.getMaterialTypeId(), 1, "testBarcode", 0.0, 1.0, 2.0, 3.0); material = mc.getMaterialByName("testName"); }
@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(); }