dialogFixture.list("ListParticipant").selectItem(0);
dialogFixture.button("SaveAccident").click();
Accident accident = new Accident();
accident.setRegisteredBy("test");
List<Accident> list = accidentManager.findByObject(accident);
assertNotNull(list);
assertEquals(1, list.size());
accident = list.get(0);
accidentManager.lazyLoad(accident, new LazyLoadEnum[][] { {
LazyLoadEnum.ACCIDENT_PARTICIPANTS, LazyLoadEnum.NONE } });
assertEquals("test", accident.getRegisteredBy());
assertEquals("Transport", accident.getJobFunction()
.getJobFunctionName());
assertEquals("testbeskrivelse", accident.getAccidentDescription());
assertEquals("test�rsak", accident.getAccidentCause());
Set<AccidentParticipant> participants = accident
.getAccidentParticipants();
assertNotNull(participants);
assertEquals(1, participants.size());
AccidentParticipant participant = participants.iterator().next();
assertEquals("Atle", participant.getFirstName());
assertEquals("Brekka", participant.getLastName());
assertEquals("Sj�f�r", participant.getEmployeeType()
.getEmployeeTypeName());
dialogFixture.button("ButtonDeleteParticipant").requireEnabled();
dialogFixture.button("ButtonDeleteParticipant").click();
JOptionPaneFinder.findOptionPane().using(dialogFixture.robot)
.buttonWithText("Ja").click();
assertEquals(0, dialogFixture.list("ListParticipant").target.getModel()
.getSize());
dialogFixture.button("SaveAccident").click();
accident = new Accident();
accident.setRegisteredBy("test");
list = accidentManager.findByObject(accident);
assertNotNull(list);
assertEquals(1, list.size());
accident = list.get(0);
accidentManager.lazyLoad(accident, new LazyLoadEnum[][] { {
LazyLoadEnum.ACCIDENT_PARTICIPANTS, LazyLoadEnum.NONE } });
participants = accident.getAccidentParticipants();
assertNotNull(participants);
assertEquals(0, participants.size());
dialogFixture.close();
}