Entity tests

There is no current use of warnings in entity tests that can easily be improved, so for now we will use a slightly contrived example. (This is slightly contrived, because Installation is a special record, and the change below is not actually allowed in the application due to some records on the Adjustment Type table, and a validation on Installation.)


			    public void testChangeBillSegmentFreeze() {
			        Installation installation = getValidTestObject();
			        Installation_DTO instDto = (Installation_DTO) installation.getDTO();
			
			        instDto.setBillSegmentFreezeOption
			             (BillSegmentFreezeOptionLookup.FREEZE_AT_WILL);
			        installation.setDTO(instDto);
			
			        instDto.setBillSegmentFreezeOption
			             (BillSegmentFreezeOptionLookup.FREEZE_AT_BILL_COMPLETION);
			        installation.setDTO(instDto);
			        verifyWarningsContain
			             (MessageRepository.changeBillSegmentFreezeWarning());
			    }
			
		

Since warnings are enabled by default, nothing needs to be stated at the outset. Additionally, the conversion of warnings to an exception occurs at a later point, so there is no ApplicationWarning to catch. Instead, after the offending statement (in this case the setDTO method) you should just verify that the current warnings contain the specified message.