use of jakarta.nosql.query.NumberQueryValue in project jnosql-diana by eclipse.
the class SelectQueryProviderTest method shouldReturnParserQuery10.
@ParameterizedTest(name = "Should parser the query {0}")
@ValueSource(strings = { "select * from God where stamina > 10.23" })
public void shouldReturnParserQuery10(String query) {
SelectQuery selectQuery = checkSelectFromStart(query);
assertTrue(selectQuery.getWhere().isPresent());
Where where = selectQuery.getWhere().get();
Condition condition = where.getCondition();
QueryValue<?> value = condition.getValue();
Assertions.assertEquals(Operator.GREATER_THAN, condition.getOperator());
assertEquals("stamina", condition.getName());
assertTrue(value instanceof NumberQueryValue);
assertEquals(10.23, value.get());
}
use of jakarta.nosql.query.NumberQueryValue in project jnosql-diana by eclipse.
the class UpdateQueryProviderTest method shouldReturnParserQuery2.
@ParameterizedTest(name = "Should parser the query {0}")
@ValueSource(strings = { "update God (stamina = 32.23)" })
public void shouldReturnParserQuery2(String query) {
UpdateQuery updateQuery = checkUpdateFromStart(query);
List<Condition> conditions = updateQuery.getConditions();
assertEquals(1, conditions.size());
Condition condition = conditions.get(0);
assertEquals("stamina", condition.getName());
assertEquals(Operator.EQUALS, condition.getOperator());
QueryValue<?> value = condition.getValue();
assertTrue(value instanceof NumberQueryValue);
assertEquals(32.23, NumberQueryValue.class.cast(value).get());
}
use of jakarta.nosql.query.NumberQueryValue in project jnosql-diana by eclipse.
the class PutProviderTest method shouldReturnParserQuery2.
@ParameterizedTest(name = "Should parser the query {0}")
@ValueSource(strings = { "put {12, 12.12}\n" })
public void shouldReturnParserQuery2(String query) {
PutQuery putQuery = provider.apply(query);
QueryValue<?> key = putQuery.getKey();
QueryValue<?> value = putQuery.getValue();
Optional<Duration> ttl = putQuery.getTtl();
assertTrue(key instanceof NumberQueryValue);
assertEquals(12L, NumberQueryValue.class.cast(key).get());
assertTrue(value instanceof NumberQueryValue);
assertEquals(12.12, NumberQueryValue.class.cast(value).get());
assertFalse(ttl.isPresent());
}
use of jakarta.nosql.query.NumberQueryValue in project jnosql-diana by eclipse.
the class GetProviderTest method shouldReturnParserQuery4.
@ParameterizedTest(name = "Should parser the query {0}")
@ValueSource(strings = { "get -12.12" })
public void shouldReturnParserQuery4(String query) {
GetQuery getQuery = queryProvider.apply(query);
List<QueryValue<?>> keys = getQuery.getKeys();
assertEquals(1, keys.size());
QueryValue<?> key = keys.get(0);
assertTrue(key instanceof NumberQueryValue);
assertEquals(-12.12, NumberQueryValue.class.cast(key).get());
}
use of jakarta.nosql.query.NumberQueryValue in project jnosql-diana by eclipse.
the class InsertQueryProviderTest method shouldReturnParserQuery2.
@ParameterizedTest(name = "Should parser the query {0}")
@ValueSource(strings = { "insert God (stamina = 32.23)" })
public void shouldReturnParserQuery2(String query) {
InsertQuery insertQuery = checkInsertFromStart(query);
List<Condition> conditions = insertQuery.getConditions();
assertEquals(1, conditions.size());
Condition condition = conditions.get(0);
assertEquals("stamina", condition.getName());
assertEquals(Operator.EQUALS, condition.getOperator());
QueryValue<?> value = condition.getValue();
assertTrue(value instanceof NumberQueryValue);
assertEquals(32.23, NumberQueryValue.class.cast(value).get());
assertFalse(insertQuery.getTtl().isPresent());
}
Aggregations