/** * 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); }
/** * Prepare Data of FinancialYear using setMethod * * @return FinancialYear * @throws Exception */ public FinancialYear prepareFinancialYear() throws Exception { FinancialYear financialYear = new FinancialYear(); financialYear.setLabel("13-14"); String startDate = "01 APR, 2013"; String endDate = "31 MAR, 2014"; SimpleDateFormat sdf = new SimpleDateFormat("dd MMM, yyyy"); financialYear.setYearstartdate(sdf.parse(startDate)); financialYear.setYearenddate(sdf.parse(endDate)); return financialYear; }