use of jakarta.nosql.Settings in project jnosql-diana by eclipse.
the class DefaultSettingsTest method shouldReturnErrorWhenPrefixIsNull.
@Test
public void shouldReturnErrorWhenPrefixIsNull() {
Settings settings = Settings.builder().put("host", "host").put("host-1", "host-1").put("host-2", "host-2").put("host-3", "host-3").build();
assertThrows(NullPointerException.class, () -> settings.prefix((String) null));
}
use of jakarta.nosql.Settings in project jnosql-diana by eclipse.
the class DefaultSettingsTest method shouldGetOrDefault.
@Test
public void shouldGetOrDefault() {
Settings settings = Settings.of(singletonMap("key", "12"));
assertEquals("12", settings.getOrDefault("key", "13"));
assertEquals("13", settings.getOrDefault("key-1", "13"));
}
use of jakarta.nosql.Settings in project jnosql-diana by eclipse.
the class DefaultSettingsTest method shouldReturnErrorWhenPrefixesIsNull.
@Test
public void shouldReturnErrorWhenPrefixesIsNull() {
Settings settings = Settings.builder().put("host", "host").put("host-1", "host-1").put("host-2", "host-2").put("host-3", "host-3").build();
assertThrows(NullPointerException.class, () -> settings.prefix((Collection<String>) null));
}
use of jakarta.nosql.Settings in project jnosql-diana by eclipse.
the class SettingsBuilderTest method shouldCreateSettingsBuilder.
@Test
public void shouldCreateSettingsBuilder() {
Settings settings = Settings.builder().put("key", "value").build();
assertNotNull(settings);
assertEquals("value", settings.get("key").get());
}
use of jakarta.nosql.Settings in project jnosql-diana by eclipse.
the class DefaultSettingsTest method shouldIterateUsingForEach.
@Test
public void shouldIterateUsingForEach() {
Settings settings = Settings.of(singletonMap("key", "12"));
List<Map.Entry<String, Object>> references = new ArrayList<>();
settings.forEach((k, v) -> references.add(new AbstractMap.SimpleEntry<>(k, v)));
assertFalse(references.isEmpty());
Map.Entry<String, Object> entry = references.get(0);
Assertions.assertEquals("key", entry.getKey());
Assertions.assertEquals("12", entry.getValue());
}
Aggregations