EmpireGroupDao extends EmpireDao implements GroupDao { @Override public Group find(int id) { DBRecord dbr = new DBRecord(); try { dbr.read(table, id, getConnection()); Group group = new Group(); dbr.getBeanProperties(group); return group; } catch (RecordNotFoundException ex) { return null; } finally { dbr.close(); } } EmpireGroupDao(ProarcDatabase db); @Override Group create(); @Override void update(Group group); @Override Group find(int id); @Override List<Group> find(Integer id, String grpName, String grpRemoteName, String grpRemoteType);  }
@Test public void testFind() throws Exception { IDataSet db = database( support.loadFlatXmlDataStream(getClass(), "group.xml") ); support.cleanInsert(support.getConnection(tx), db); tx.commit(); Integer id = 1; Group result = dao.find(id); assertNotNull(result); assertEquals(Timestamp.valueOf("2013-01-12 00:00:00"), result.getCreated()); assertEquals(id, result.getId()); assertEquals("group:testgrp", result.getName()); assertEquals("GroupTitle", result.getTitle()); assertEquals(dbTimestamp, result.getTimestamp()); }
@Test public void testFindName() throws Exception { IDataSet db = database( support.loadFlatXmlDataStream(getClass(), "group.xml") ); support.cleanInsert(support.getConnection(tx), db); tx.commit(); List<Group> find = dao.find(null, "group:testgrp", null, null); assertNotNull(find); assertEquals(1, find.size()); Group result = find.get(0); assertNotNull(result); assertEquals(Timestamp.valueOf("2013-01-12 00:00:00"), result.getCreated()); assertEquals(Integer.valueOf(1), result.getId()); assertEquals("group:testgrp", result.getName()); assertEquals("GroupTitle", result.getTitle()); assertEquals(dbTimestamp, result.getTimestamp()); find = dao.find(null, null, "DESA_GROUP", "DESA"); assertNotNull(find); assertEquals(1, find.size()); }