### Question:
SpellDaoImpl extends DaoBaseImpl<Spell> implements SpellDao { @Override public Spell findByName(String name) { Transaction tx = null; Spell result; try (var session = getSessionFactory().openSession()) { tx = session.beginTransaction(); var criteria = session.createCriteria(persistentClass); criteria.add(Restrictions.eq("name", name)); result = (Spell) criteria.uniqueResult(); tx.commit(); } catch (Exception e) { if (tx != null) { tx.rollback(); } throw e; } return result; }  @Override Spell findByName(String name);  }### Answer:
@Test public void testFindByName() { final var dao = getDao(); final var allSpells = dao.findAll(); for (final var spell : allSpells) { final var spellByName = dao.findByName(spell.getName()); assertNotNull(spellByName); assertEquals(spell.getId(), spellByName.getId()); assertEquals(spell.getName(), spellByName.getName()); } }