@Test(expected = UncheckedIOException.class) public void readJsonFile_test() throws IOException { Resource resource = mock(Resource.class); when(resource.getInputStream()).thenThrow(IOException.class); target.readJsonFile(resource); }
MetadataStatement readJsonFile(Resource resource) { try (InputStream inputStream = resource.getInputStream()) { return jsonConverter.readValue(inputStream, MetadataStatement.class); } catch (IOException e) { throw new UncheckedIOException("Failed to load a metadata statement json file", e); } }
JsonFileResourceMetadataStatementsProvider implements MetadataStatementsProvider, InitializingBean { MetadataStatement readJsonFile(Resource resource) { try (InputStream inputStream = resource.getInputStream()) { return jsonConverter.readValue(inputStream, MetadataStatement.class); } catch (IOException e) { throw new UncheckedIOException("Failed to load a metadata statement json file", e); } } }
JsonFileResourceMetadataStatementsProvider implements MetadataStatementsProvider, InitializingBean { MetadataStatement readJsonFile(Resource resource) { try (InputStream inputStream = resource.getInputStream()) { return jsonConverter.readValue(inputStream, MetadataStatement.class); } catch (IOException e) { throw new UncheckedIOException("Failed to load a metadata statement json file", e); } } JsonFileResourceMetadataStatementsProvider(ObjectConverter objectConverter); }
JsonFileResourceMetadataStatementsProvider implements MetadataStatementsProvider, InitializingBean { MetadataStatement readJsonFile(Resource resource) { try (InputStream inputStream = resource.getInputStream()) { return jsonConverter.readValue(inputStream, MetadataStatement.class); } catch (IOException e) { throw new UncheckedIOException("Failed to load a metadata statement json file", e); } } JsonFileResourceMetadataStatementsProvider(ObjectConverter objectConverter); @Override void afterPropertiesSet(); @Override Map<AAGUID, Set<MetadataStatement>> provide(); List<Resource> getResources(); void setResources(List<Resource> resources); }
JsonFileResourceMetadataStatementsProvider implements MetadataStatementsProvider, InitializingBean { MetadataStatement readJsonFile(Resource resource) { try (InputStream inputStream = resource.getInputStream()) { return jsonConverter.readValue(inputStream, MetadataStatement.class); } catch (IOException e) { throw new UncheckedIOException("Failed to load a metadata statement json file", e); } } JsonFileResourceMetadataStatementsProvider(ObjectConverter objectConverter); @Override void afterPropertiesSet(); @Override Map<AAGUID, Set<MetadataStatement>> provide(); List<Resource> getResources(); void setResources(List<Resource> resources);  }