DuraStoreDataSource implements DataSource { @Override public Content getContent(String spaceId, String contentId) { log.debug("getContent({}, {})", spaceId, contentId); try { return store.getContent(spaceId, contentId); } catch (ContentStoreException e) { String msg = "Error getting content: " + e.getMessage(); if (!(e instanceof NotFoundException)) { log.error(msg); } else { log.debug(msg); } throw new DataSourceException(msg, e); } } DuraStoreDataSource(ContentStore store); @Override Content getContent(String spaceId, String contentId);  }
@Test public void testGetContent() throws Exception { createGetContentMocks(true); replayMocks(); dataSource = new DuraStoreDataSource(store); dataSource.getContent(spaceId, contentId); }
@Test public void testGetContentError() throws Exception { createGetContentMocks(false); replayMocks(); dataSource = new DuraStoreDataSource(store); try { dataSource.getContent(spaceId, contentId); Assert.fail("exception expected"); } catch (DataSourceException e) { Assert.assertNotNull(e); } }