### Question:
GroupDao { protected GroupModel generateGroup(GroupModel group) { GroupModel filter = new GroupModel(); filter.setServiceId(group.getServiceId()); filter.setRegionId(group.getRegionId()); filter.setZoneId(group.getZoneId()); filter.setName(group.getName()); List<GroupModel> newGroups = select(filter); if (newGroups.size() == 0) { insert(group); newGroups = select(filter); } return newGroups.get(0); } private  GroupDao(); List<GroupModel> query(); List<GroupModel> select(GroupModel filter); List<GroupModel> select(List<Long> groupIds); static final GroupDao INSTANCE; }### Answer:
@Test public void testGenerateGroup() { GroupModel group = newGroup(); GroupModel newGroup = groupDao.generateGroup(group); Assert.assertNotNull(newGroup.getId()); assertGroup(newGroup, group); }