use of org.jnosql.artemis.model.User in project jnosql-artemis by eclipse.
the class DefaultKeyValueEntityConverterTest method shouldConvertAndFeedTheKeyValueIfKeyAndFieldAreDifferent.
@Test
public void shouldConvertAndFeedTheKeyValueIfKeyAndFieldAreDifferent() {
User expectedUser = new User("nickname", "name", 21);
User user = converter.toEntity(User.class, KeyValueEntity.of("nickname", new User("newName", "name", 21)));
assertEquals(expectedUser, user);
}
use of org.jnosql.artemis.model.User in project jnosql-artemis by eclipse.
the class DefaultKeyValueTemplateTest method shouldPutTTL.
@Test
public void shouldPutTTL() {
Duration duration = Duration.ofSeconds(2L);
User user = new User(KEY, "otavio", 27);
subject.put(user, duration);
Mockito.verify(manager).put(captor.capture(), Mockito.eq(duration));
KeyValueEntity entity = captor.getValue();
assertEquals(KEY, entity.getKey());
assertEquals(user, entity.getValue().get());
}
use of org.jnosql.artemis.model.User in project jnosql-artemis by eclipse.
the class DefaultKeyValueTemplateTest method shouldCheckNullParametersInGet.
@Test
public void shouldCheckNullParametersInGet() {
User user = new User(KEY, "otavio", 27);
assertThrows(NullPointerException.class, () -> subject.get(null, null));
assertThrows(NullPointerException.class, () -> subject.get(user, null));
assertThrows(NullPointerException.class, () -> subject.get(null, User.class));
}
use of org.jnosql.artemis.model.User in project jnosql-artemis by eclipse.
the class DefaultKeyValueTemplateTest method shouldCheckNullParametersInPut.
@Test
public void shouldCheckNullParametersInPut() {
User user = new User(KEY, "otavio", 27);
assertThrows(NullPointerException.class, () -> subject.put(null));
assertThrows(NullPointerException.class, () -> subject.put(null, null));
assertThrows(NullPointerException.class, () -> subject.put(null, Duration.ofSeconds(2L)));
assertThrows(NullPointerException.class, () -> subject.put(user, null));
assertThrows(NullPointerException.class, () -> subject.put((Iterable<? extends Object>) null));
assertThrows(NullPointerException.class, () -> subject.put((Iterable<? extends Object>) null, null));
}
use of org.jnosql.artemis.model.User in project jnosql-artemis by eclipse.
the class DefaultKeyValueTemplateTest method shouldPut.
@Test
public void shouldPut() {
User user = new User(KEY, "otavio", 27);
subject.put(user);
Mockito.verify(manager).put(captor.capture());
KeyValueEntity entity = captor.getValue();
assertEquals(KEY, entity.getKey());
assertEquals(user, entity.getValue().get());
}
Aggregations