FileStorage implements Storage { @Override public InputStream load() { try { if (configFile.exists()) { return new FileInputStream(configFile); } return null; } catch (final FileNotFoundException e) { throw new RuntimeException(e); } } FileStorage();   FileStorage(final File localStorageDirectory); @Override void save(final InputStream stream); @Override InputStream load();  }
@Test public void testLoadConfigurationReturnsNullWhenStoreIsEmpty() throws Exception { assertNull(storage.load()); }
@Test public void testLoadConfiguration() throws Exception { makeConfigurationExisting("test".getBytes()); assertArrayEquals("test".getBytes(), IOUtils.toByteArray(storage.load())); }