public void test_create_with_mapping_dao_interface() { DaoInvokerFactory factory = DaoInvokerFactory.getInstance(); @SuppressWarnings("unchecked") MappingDao<Object> daoMock = mock(MappingDao.class); DaoInvoker daoInvoker = factory.create(daoMock, objectStore); assertNotNull(daoInvoker); Object entity = new Object(); daoInvoker.insert("myInsert", entity); verify(daoMock).insert(eq("myInsert"), same(entity)); }
public void test_create_with_annotated_dao() { DaoInvokerFactory factory = DaoInvokerFactory.getInstance(); FullAnnotatedDao daoMock = mock(FullAnnotatedDao.class); DaoInvoker daoInvoker = factory.create(daoMock, objectStore); assertNotNull(daoInvoker); Object entity = new Object(); daoInvoker.insert(entity); verify(daoMock).insertIt(same(entity)); assertNotNull(objectStore.get(DaoInvokerFactory.REPOSITORY_KEY)); }