@Test public void testGetHasCostsWithCost() throws SQLException, IOException { costBean.setCostValue("12"); costBean.setText("FOOD"); costBean.addCost(); assertEquals(" should be true", true, costBean.getHasCosts()); }
@Test public void testAddCost() throws SQLException, IOException { costBean.setCostValue("12"); costBean.setText("FOOD"); costBean.addCost(); assertEquals("Texts should be equal", "FOOD", costService.getCostByCostId(2).getText()); }
@Test public void testEditCost() throws SQLException, IOException { costBean.setCostValue("12"); costBean.setText("FOOD"); costBean.addCost(); costBean.editCost(costBean.getCurrentCost()); assertEquals("Texts should be equal", "FOOD", costBean.getNewtext()); }
@Test public void testDeleteCost() throws SQLException, IOException { costBean.setCostValue("12"); costBean.setText("FOOD"); costBean.addCost(); costBean.deleteCost(costBean.getCurrentCost()); assertEquals( "size should be equal", 0, costService.getCostsByTrip(costBean.getCurrentTrip()).size()); }
@Test public void testUpdateCost() throws SQLException, IOException { costBean.setCostValue("12"); costBean.setText("FOOD"); costBean.addCost(); costBean.setNewcostValue("30"); costBean.setNewtext("BEER"); costBean.updateCost(); assertEquals("Texts should be equal", "BEER", costService.getCostByCostId(3).getText()); }