### Question:
IncomingMessageFormDefinitionDAOImpl extends HibernateGenericDAOImpl<IncomingMessageFormDefinitionImpl> implements IncomingMessageFormDefinitionDAO<IncomingMessageFormDefinitionImpl> { public IncomingMessageFormDefinition getByCode(String formCode) { logger.debug("variable passed to getByCode: " + formCode); try { Criterion code = Restrictions.eq("formCode", formCode); IncomingMessageFormDefinition definition = (IncomingMessageFormDefinition)this.getSessionFactory().getCurrentSession().createCriteria(this.getPersistentClass()) .add(code) .setMaxResults(1) .uniqueResult(); logger.debug(definition); return definition; } catch (HibernateException he) { logger.error("Persistence or JDBC Exception in getByCode", he); return null; } catch (Exception ex) { logger.error("Exception in getByCode", ex); return null; } }  IncomingMessageFormDefinition getByCode(String formCode);  }### Answer:
@Test public void testGetByCode() { System.out.println("getByCode"); IncomingMessageFormDefinition result = imfDAO.getByCode(formCode); assertNotNull(result); assertEquals(result.getFormCode(), formCode); System.out.println(result.toString()); }