/** * Get FinancialYear object of specific id using financialYearService.get() If financialYear == * null test will be failed. * * @throws Exception */ @Test public void getCurrentFinancialYear() throws Exception { FinancialYear financialYear = prepareFinancialYear(); financialYearService.save(financialYear); financialYear = financialYearService.getCurrentFinancialYear(); Assert.assertTrue(financialYear != null); }
/** * Get FinancialYear and update using financialYearService.updateFinancialYear() If * financialYear.getId()=0 test will be failed * * @throws Exception */ @Test public void updateFinancialYear() throws Exception { FinancialYear financialYear = prepareFinancialYear(); financialYearService.get(financialYear.getId()); financialYear.setLabel("2012-2013"); financialYearService.save(financialYear); Assert.assertTrue(financialYear.getId() != 0); }
/** * Get FinancialYear object of specific id using financialYearService.get() If financialYear == * null test will be failed. * * @throws Exception */ @Test public void getFinancialYear() throws Exception { FinancialYear financialYear = prepareFinancialYear(); financialYearService.save(financialYear); financialYear = financialYearService.get(financialYear.getId()); // logger.info("FinancialYearTestCase.getFinancialYear() :: financialYear.getId()" + // financialYear.getId()); Assert.assertTrue(financialYear != null); }
/** * List all FinancialYear using financialYearService.getAllFinancialYears() If * lstFinancialYear.size()!= actual size and test will be failed * * @throws Exception */ @Test public void getAllFinancialYears() throws Exception { FinancialYear financialYear = prepareFinancialYear(); List<FinancialYear> lstFinancialYear = financialYearService.getAllFinancialYears(); int result = simpleJdbcTemplate.queryForInt("select count(*) from financialYear"); Assert.assertEquals(lstFinancialYear.size(), result); }
/** * Save null using financialYearService.save() If financialYearService.save() saves null value no * exception will be thrown and test fail. * * @throws Exception */ @Test public void saveNullFinancialYear() throws Exception { try { financialYearService.save(null); } catch (Exception e) { Assert.assertEquals(e.getMessage(), "FinancialYearDaoImpl.save():: Null financial year"); } }