@Test public void testDefaultValues() { parameterService.autoGenSponsorCode = false; sponsorMaintainableImpl.setGenerateDefaultValues(SPONSOR_DOC_TYPE_NAME); Sponsor sponsor = (Sponsor) sponsorMaintainableImpl.getBusinessObject(); assertTrue(StringUtils.isBlank(sponsor.getSponsorCode())); }
@Before public void setUp() throws Exception { parameterService = new ParameterServiceMock(); sponsorMaintainableImpl = new SponsorMaintainableImpl(); sponsorMaintainableImpl.setBoClass(Sponsor.class); sponsorMaintainableImpl.setBusinessObject(new Sponsor()); sponsorMaintainableImpl.setParameterService(parameterService); sponsorMaintainableImpl.setSponsorCodeIncrementer( new DataFieldMaxValueIncrementer() { int i = 0; @Override public int nextIntValue() throws DataAccessException { return i++; } @Override public long nextLongValue() throws DataAccessException { return i++; } @Override public String nextStringValue() throws DataAccessException { return String.valueOf(i++); } }); }