createNewSubmit(em, i);
}
em.getTransaction().commit();
em.close();
em = perUtils.createEntityManager();
Submit id1 = Submit.getById(em, 1);
List<Submit> result = splitDups.splitDuplicates(new String[]{"2", "3", "4"}, "1");
assertEquals(3, result.size());
for (Submit sbm : result) {
assertEquals(id1.getReportId(), sbm.getReportId());
}
result = splitDups.splitDuplicates(new String[0], "1");
assertTrue(result.isEmpty());
result = splitDups.splitDuplicates(new String[]{"1"}, "1");
assertEquals(result.iterator().next(), id1);
assertEquals(new Integer(1), id1.getReportId().getId());
em.close();
result = splitDups.splitDuplicates(new String[]{"2", "3", "4", "5", "9"}, "3");
assertEquals(5, result.size());
em = perUtils.createEntityManager();
em.getTransaction().begin();
Submit id3 = Submit.getById(em, 3);
for (Submit exceptions : result) {
assertEquals(id3.getReportId(), exceptions.getReportId());
assertTrue(exceptions.getReportId().getDuplicateManChanged());
}
em.getTransaction().commit();
em.close();
}