### Question:
GroupHibernateDao extends GenericDao<Group> implements GroupDao { @Override public Group getGroupByName(String name) { Validate.notNull(name, "User Group name can't be null"); Query query = session().getNamedQuery("findGroupExactlyByName"); query.setString("name", name); return (Group) query.uniqueResult(); } GroupHibernateDao(SessionFactory sessionFactory); @Override @SuppressWarnings("unchecked") List<Group> getAll(); @SuppressWarnings("unchecked") @Override List<Group> getMatchedByName(String name); @Override Group getGroupByName(String name); @Override void delete(Group group); @Override List<Group> getGroupsOfUser(User user); @Override List<Group> getGroupsByIds(List<Long> ids); @SuppressWarnings("unchecked") @Override List<Group> getByNameContains(String name); @Override List<Group> getByName(String name); @SuppressWarnings("unchecked") @Override List<GroupAdministrationDto> getGroupNamesWithCountOfUsers(); @Override List<UserDto> getGroupUsersPage(long id, PageRequest pageRequest); @Override int getGroupUserCount(long id);  }### Answer:
@Test public void testGetByNameFailWithEmptyString() { Group group = ObjectsFactory.getRandomGroup(); saveAndEvict(group); Group actual = groupDao.getGroupByName(NO_FILTER); assertNull(actual); }
@Test public void testGetByNameLowerCase() { Group group = ObjectsFactory.getRandomGroup(); saveAndEvict(group); Group actual = groupDao.getGroupByName(group.getName().toLowerCase()); assertReflectionEquals(actual, group); }
@Test public void testGetByNameUpperCase() { Group group = ObjectsFactory.getRandomGroup(); saveAndEvict(group); Group actual = groupDao.getGroupByName(group.getName().toUpperCase()); assertReflectionEquals(actual, group); }
@Test public void testGetByNameWithSpecialChars() { Group group = ObjectsFactory.getRandomGroup(); group.setName("!@#$%^&*()\"\'\\/"); saveAndEvict(group); Group actual = groupDao.getGroupByName(group.getName()); assertReflectionEquals(actual, group); }