use of jakarta.nosql.keyvalue.KeyValueEntity in project jnosql-diana by eclipse.
the class DefaultKeyValueQueryParserTest method shouldReturnParserQuery2.
@ParameterizedTest(name = "Should parser the query {0}")
@ValueSource(strings = { "put {\"Diana\", \"Hunt\"}" })
public void shouldReturnParserQuery2(String query) {
ArgumentCaptor<KeyValueEntity> captor = ArgumentCaptor.forClass(KeyValueEntity.class);
parser.query(query, manager);
Mockito.verify(manager).put(captor.capture());
KeyValueEntity entity = captor.getValue();
assertEquals("Diana", entity.getKey());
assertEquals("Hunt", entity.getValue());
}
use of jakarta.nosql.keyvalue.KeyValueEntity in project jnosql-diana by eclipse.
the class PutQueryParserTest method shouldReturnParserQuery1.
@ParameterizedTest(name = "Should parser the query {0}")
@ValueSource(strings = { "put {\"Diana\", \"Hunt\"}" })
public void shouldReturnParserQuery1(String query) {
ArgumentCaptor<KeyValueEntity> captor = ArgumentCaptor.forClass(KeyValueEntity.class);
parser.query(query, manager);
Mockito.verify(manager).put(captor.capture());
KeyValueEntity entity = captor.getValue();
assertEquals("Diana", entity.getKey());
assertEquals("Hunt", entity.getValue());
}
use of jakarta.nosql.keyvalue.KeyValueEntity in project jnosql-diana by eclipse.
the class PutQueryParserTest method shouldExecutePrepareStatement.
@ParameterizedTest(name = "Should parser the query {0}")
@ValueSource(strings = { "put {\"Diana\", @value}" })
public void shouldExecutePrepareStatement(String query) {
KeyValuePreparedStatement prepare = parser.prepare(query, manager);
prepare.bind("value", "Hunt");
prepare.getResult();
ArgumentCaptor<KeyValueEntity> captor = ArgumentCaptor.forClass(KeyValueEntity.class);
Mockito.verify(manager).put(captor.capture());
KeyValueEntity entity = captor.getValue();
assertEquals("Diana", entity.getKey());
assertEquals("Hunt", entity.getValue());
}
use of jakarta.nosql.keyvalue.KeyValueEntity in project jnosql-diana by eclipse.
the class ParamsTest method shouldSetParameter.
@Test
public void shouldSetParameter() {
Params params = Params.newParams();
Value name = params.add("name");
KeyValueEntity entity = KeyValueEntity.of("name", name);
params.bind("name", "Ada Lovelace");
assertEquals("Ada Lovelace", entity.getValue());
params.bind("name", "Diana");
assertEquals("Diana", entity.getValue());
}
use of jakarta.nosql.keyvalue.KeyValueEntity in project jnosql-diana by eclipse.
the class DefaultKeyValueEventPersistManagerTest method shouldFirePreColumn.
@Test
public void shouldFirePreColumn() {
KeyValueEntity entity = KeyValueEntity.of("key", "value");
subject.firePreKeyValue(entity);
ArgumentCaptor<KeyValueEntityPrePersist> captor = ArgumentCaptor.forClass(KeyValueEntityPrePersist.class);
verify(keyValueEntityPrePersistEvent).fire(captor.capture());
KeyValueEntityPrePersist captorValue = captor.getValue();
assertEquals(entity, captorValue.getEntity());
}
Aggregations