SimplePropertySource extends BasePropertySource { public static Builder newBuilder() { return new Builder(); } SimplePropertySource(File propertiesLocation);  SimplePropertySource(URL propertiesLocation);  SimplePropertySource(String name, Map<String, String> properties, int defaultOrdinal);  SimplePropertySource(String name, Map<String, String> properties);  SimplePropertySource(String name, URL propertiesLocation); private  SimplePropertySource(Builder builder); static Builder newBuilder(); @Override Map<String, PropertyValue> getProperties(); @Override ChangeSupport getChangeSupport();  }
@Test public void builder() throws Exception { assertThat(SimplePropertySource.newBuilder()).isNotNull(); assertThat(SimplePropertySource.newBuilder()).isNotEqualTo(SimplePropertySource.newBuilder()); }
@Test public void getOrdinal() throws Exception { SimplePropertySource ps1 = SimplePropertySource.newBuilder() .withUuidName() .withOrdinal(55) .withDefaultOrdinal(166) .build(); assertThat(ps1.getOrdinal()).isEqualTo(55); assertThat(ps1.getDefaultOrdinal()).isEqualTo(166); }
@Test public void getName() throws Exception { SimplePropertySource ps1 = SimplePropertySource.newBuilder() .withUuidName().build(); assertThat(UUID.fromString(ps1.getName())).isNotNull(); }
@Test public void get() throws Exception { SimplePropertySource ps1 = SimplePropertySource.newBuilder() .withUuidName() .withProperty("a", "b").build(); assertThat(ps1.get("a").getValue()).isEqualTo("b"); }
@Test public void testScannable() { SimplePropertySource sps = SimplePropertySource.newBuilder().withUuidName().build(); assertThat(sps.isScannable()).isTrue(); }
@Test public void buildingWithValidName() { final String key = "myTestKey"; Builder builder = SimplePropertySource.newBuilder().withName(key); assertThat(builder.build().getName()).isEqualTo(key); }
@Test(expected = NullPointerException.class) public void buildingWithInvalidNameYieldsNPE() { SimplePropertySource.newBuilder().withName(null); }