public void testStoreCanStoreData() throws Exception { String testData = "some file data"; AttachmentId id = new AttachmentId("", "id_1"); AttachmentStore store = makeStoreWithData(id, testData); AttachmentData data = store.getAttachment(id); assertEquals(testData, dataToString(data)); }
public void testStoreCanStoreData() throws Exception { String testData = "some file data"; AttachmentId id = new AttachmentId("", "id_1"); AttachmentStore store = makeStoreWithData(id, testData); AttachmentData data = store.getAttachment(id); assertEquals(testData, dataToString(data)); }
public void testOverwriteAttachmentThrowsException() throws Exception { String testData = "First."; AttachmentId id = new AttachmentId("", "id_7"); AttachmentStore store = makeStoreWithData(id, testData); boolean exceptionThrown=false; try { // A second element added with the same ID should not write. writeStringDataToAttachmentStore(store, id, "Second"); } catch (IOException ex) { exceptionThrown=true; } //assertTrue(exceptionThrown); // Check that the database still contains the original entry assertEquals(testData, dataToString(store.getAttachment(id))); }
public void testOverwriteAttachmentThrowsException() throws Exception { String testData = "First."; AttachmentId id = new AttachmentId("", "id_7"); AttachmentStore store = makeStoreWithData(id, testData); boolean exceptionThrown=false; try { // A second element added with the same ID should not write. writeStringDataToAttachmentStore(store, id, "Second"); } catch (IOException ex) { exceptionThrown=true; } //assertTrue(exceptionThrown); // Check that the database still contains the original entry assertEquals(testData, dataToString(store.getAttachment(id))); }