HibernateRecordTypeDefinitionDao extends HibernateDaoSupport implements RecordTypeDefinitionDao { public RecordTypeDefinition getRecordTypeDefinition(String id) { LOGGER.debug("get RecordTypeDefinition(id = \"{}\")", id); RecordTypeDefinition recordTypeDefinition = (RecordTypeDefinition) getHibernateTemplate().get(RecordTypeDefinition.class, id); LOGGER.debug("get RecordTypeDefinition(id = \"{}\") = {}", id, recordTypeDefinition); return recordTypeDefinition; }  RecordTypeDefinition getRecordTypeDefinition(String id);  }
@Test public void testReadSucceeds() throws Exception { RecordTypeDefinition rtd0 = dao.getRecordTypeDefinition("M1"); assertNotNull(rtd0); assertTrue(rtd0.isValid()); assertEquals("M1", rtd0.getId()); assertNull(rtd0.getParent()); assertEquals(3, rtd0.getFields().size()); assertEquals("string", rtd0.getField("a").getTypeId()); assertEquals("integer", rtd0.getField("b").getTypeId()); assertEquals("boolean", rtd0.getField("c").getTypeId()); RecordTypeDefinition rtd1 = dao.getRecordTypeDefinition("M2"); assertNotNull(rtd1); assertTrue(rtd1.isValid()); assertEquals("M2", rtd1.getId()); assertNull(rtd1.getParent()); assertEquals(2, rtd1.getFields().size(), 2); assertEquals("string", rtd1.getField("d").getTypeId()); assertEquals("string", rtd1.getField("e").getTypeId()); RecordTypeDefinition rtd2 = dao.getRecordTypeDefinition("M3"); assertNotNull(rtd2); assertTrue(rtd2.isValid()); assertEquals("M3", rtd2.getId()); assertEquals(rtd1, rtd2.getParent()); assertEquals(2, rtd2.getFields().size(), 2); assertEquals("integer", rtd2.getField("f").getTypeId()); assertEquals("integer", rtd2.getField("g").getTypeId()); RecordTypeDefinition rtd3 = dao.getRecordTypeDefinition("M4"); assertNotNull(rtd3); assertTrue(rtd3.isValid()); assertEquals("M4", rtd3.getId()); assertEquals(rtd1, rtd3.getParent()); assertEquals(2, rtd3.getFields().size()); assertEquals("integer", rtd3.getField("d").getTypeId()); assertEquals("integer", rtd3.getField("f").getTypeId()); }
@Test public void testReadFails() throws Exception { RecordTypeDefinition rtd = dao.getRecordTypeDefinition("x"); assertNull(rtd); }