### Question:
SystemParameterDao extends BaseDao<SystemParameter> { public Optional<SystemParameter> findByKey(String key) { Criteria criteria = currentSession().createCriteria(SystemParameter.class); criteria.add(Restrictions.eq("key", key)); return Optional.ofNullable(uniqueResult(criteria)); } @Inject  SystemParameterDao(SessionFactory sessionFactory); Optional<SystemParameter> findByKey(String key);  }### Answer:
@Test public void findByKey() { super.createFrom(); Optional<SystemParameter> systemParameter = dao.findByKey("KEY"); Assert.assertTrue(systemParameter.isPresent()); super.deleteFrom(systemParameter.get()); }