use of jakarta.nosql.Settings in project jnosql-diana by eclipse.
the class DefaultSettingsTest method shouldReturnNewInstance.
@Test
public void shouldReturnNewInstance() {
Settings settings = Settings.of();
assertTrue(settings.isEmpty());
assertEquals(0, settings.size());
}
use of jakarta.nosql.Settings in project jnosql-diana by eclipse.
the class DefaultSettingsTest method shouldGetValueClass.
@Test
public void shouldGetValueClass() {
Settings settings = Settings.of(singletonMap("key", "12"));
Integer value = settings.get("key", Integer.class).get();
assertEquals(Integer.valueOf(12), value);
assertFalse(settings.get("key2", Integer.class).isPresent());
}
use of jakarta.nosql.Settings in project jnosql-diana by eclipse.
the class DefaultSettingsTest method shouldCreateFromMap.
@Test
public void shouldCreateFromMap() {
Settings settings = Settings.of(singletonMap("key", "value"));
assertFalse(settings.isEmpty());
assertEquals(1, settings.size());
assertEquals("value", settings.get("key").get());
}
use of jakarta.nosql.Settings in project jnosql-diana by eclipse.
the class DefaultSettingsTest method shouldGetKeys.
@Test
public void shouldGetKeys() {
Settings settings = Settings.of(singletonMap("key", "value"));
assertThat(settings.keySet(), contains("key"));
}
use of jakarta.nosql.Settings in project jnosql-diana by eclipse.
the class DefaultSettingsTest method shouldFindPrefix.
@Test
public void shouldFindPrefix() {
Settings settings = Settings.builder().put("host", "host").put("host-1", "host-1").put("host-2", "host-2").put("host-3", "host-3").build();
List<Object> hosts = settings.prefix("host");
Assertions.assertEquals(4, hosts.size());
assertThat(hosts, containsInAnyOrder("host", "host-1", "host-2", "host-3"));
}
Aggregations