DatabaseStorageService implements StorageService { @SneakyThrows @Override public InputStream read(AbsoluteLocation location) { ParsedLocation parsed = new ParsedLocation(location, allowedTables); final String sql = "SELECT value FROM " + parsed.getTableName() + " WHERE `key` = ?"; RowMapper<InputStream> rowMapper = (rs, i) -> rs.getClob("value").getAsciiStream(); List<InputStream> values = conn.jdbcTemplate(location).query( sql, new Object[] {parsed.getPathWithUser()}, rowMapper ); if (values.size() == 1) { return values.get(0); } throw new IllegalArgumentException("No item found"); }  @SneakyThrows @Override boolean objectExists(AbsoluteLocation location); @SneakyThrows @Override Stream<AbsoluteLocation<ResolvedResource>> list(AbsoluteLocation location); @SneakyThrows @Override InputStream read(AbsoluteLocation location); @SneakyThrows @Override void remove(AbsoluteLocation location); @SneakyThrows @Override OutputStream write(WithCallback<AbsoluteLocation, ? extends ResourceWriteCallback> locationWithCallback);  }
@Test @SneakyThrows void read() { try (InputStream read = storageService.read(FILE)) { assertThat(read).hasContent(MESSAGE); } }