use of jakarta.nosql.keyvalue.KeyValueEntity in project jnosql-diana by eclipse.
the class DefaultKeyValueTemplateTest method shouldPutTTLIterable.
@Test
public void shouldPutTTLIterable() {
Duration duration = Duration.ofSeconds(2L);
User user = new User(KEY, "otavio", 27);
subject.put(singletonList(user), duration);
Mockito.verify(manager).put(captor.capture(), Mockito.eq(duration));
KeyValueEntity entity = captor.getValue();
assertEquals(KEY, entity.getKey());
assertEquals(user, entity.getValue());
}
use of jakarta.nosql.keyvalue.KeyValueEntity in project jnosql-diana by eclipse.
the class DefaultKeyValueTemplateTest method shouldInsertTTLIterable.
@Test
public void shouldInsertTTLIterable() {
Duration duration = Duration.ofSeconds(2L);
User user = new User(KEY, "otavio", 27);
subject.insert(singletonList(user), duration);
Mockito.verify(manager).put(captor.capture(), Mockito.eq(duration));
KeyValueEntity entity = captor.getValue();
assertEquals(KEY, entity.getKey());
assertEquals(user, entity.getValue());
}
use of jakarta.nosql.keyvalue.KeyValueEntity in project jnosql-diana 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());
}
use of jakarta.nosql.keyvalue.KeyValueEntity in project jnosql-diana by eclipse.
the class DefaultKeyValueTemplateTest method shouldUpdate.
@Test
public void shouldUpdate() {
User user = new User(KEY, "otavio", 27);
subject.update(user);
Mockito.verify(manager).put(captor.capture());
KeyValueEntity entity = captor.getValue();
assertEquals(KEY, entity.getKey());
assertEquals(user, entity.getValue());
}
use of jakarta.nosql.keyvalue.KeyValueEntity in project jnosql-diana by eclipse.
the class DefaultKeyValueEntityConverterTest method shouldConvertToKeyWhenKeyTypeIsDifferent.
@Test
public void shouldConvertToKeyWhenKeyTypeIsDifferent() {
Person person = Person.builder().withId(123L).withName("Ada").build();
KeyValueEntity entity = converter.toKeyValue(person);
Assertions.assertEquals(123L, entity.getKey());
}
Aggregations