ConfigStorage { public static ConfigStorage create(final File file) throws IOException { return create(Files.newInputStream(file.toPath())); } private  ConfigStorage(final Properties properties); static ConfigStorage create(final File file); static ConfigStorage create(final InputStream inputStream); Optional<String> read(final Target target, final String key); String read(final Target target, final String key, final String defaultValue); boolean readBoolean(final Target target, final String propertyName, final boolean defaultValue); Optional<Boolean> readBoolean(final Target target, final String propertyName); OptionalInt readInt(final Target target, final String propertyName); int readInt(final Target target, final String propertyName, final int defaultValue); @Override boolean equals(final Object o); @Override int hashCode();  }
@Test void equality() throws IOException { final ConfigStorage cs = ConfigStorage.create(RoboZonkyTestingEventListener.class .getResourceAsStream("notifications-enabled.cfg")); assertThat(cs).isEqualTo(cs); assertThat(cs).isNotEqualTo(null); assertThat(cs).isNotEqualTo(""); final ConfigStorage cs2 = ConfigStorage.create(RoboZonkyTestingEventListener.class .getResourceAsStream("notifications-enabled.cfg")); assertThat(cs).isEqualTo(cs2); assertThat(cs2).isEqualTo(cs); final ConfigStorage cs3 = ConfigStorage.create(RoboZonkyTestingEventListener.class .getResourceAsStream( "notifications-enabled-spamless.cfg")); assertThat(cs).isNotEqualTo(cs3); assertThat(cs3).isNotEqualTo(cs); }
@Test void fromFile() throws IOException { final ConfigStorage cs = ConfigStorage.create(File.createTempFile("robozonky-", ".tmp")); assertThat(cs).isNotNull(); }