EcmStorage implements Storage { @Override public InputStream load() { try { final Document existingDocument = (Document) session.getObjectByPath("/" + WORKSPACE_ZIP_NAME); return existingDocument.getContentStream().getStream(); } catch (final CmisObjectNotFoundException e) { return null; } } EcmStorage(final Session session);   EcmStorage(final EcmService ecmService); @Override void save(final InputStream stream); @Override InputStream load();  }
@Test public void testLoadConfigurationReturnsNullWhenStoreIsEmpty() throws Exception { makeConfigurationNotExisting(); assertNull(storage.load()); }
@Test public void testLoadConfiguration() throws Exception { final Document cmisObject = Mockito.mock(Document.class); final ContentStream contentStream = mock(ContentStream.class); when(cmisObject.getContentStream()).thenReturn(contentStream); when(contentStream.getStream()).thenReturn(new ByteArrayInputStream("test".getBytes())); makeConfigurationExisting(cmisObject); assertArrayEquals("test".getBytes(), IOUtils.toByteArray(storage.load())); }