Search in sources :

Example 6 with QueryValue

use of jakarta.nosql.query.QueryValue in project jnosql-diana by eclipse.

the class RemoveProviderTest method shouldReturnParserQuery1.

@ParameterizedTest(name = "Should parser the query {0}")
@ValueSource(strings = { "del 12" })
public void shouldReturnParserQuery1(String query) {
    DelQuery delQuery = provider.apply(query);
    List<QueryValue<?>> keys = delQuery.getKeys();
    assertEquals(1, keys.size());
    QueryValue<?> key = keys.get(0);
    assertTrue(key instanceof NumberQueryValue);
    assertEquals(12L, NumberQueryValue.class.cast(key).get());
}
Also used : NumberQueryValue(jakarta.nosql.query.NumberQueryValue) DelQuery(jakarta.nosql.query.DelQuery) NumberQueryValue(jakarta.nosql.query.NumberQueryValue) QueryValue(jakarta.nosql.query.QueryValue) ArrayQueryValue(jakarta.nosql.query.ArrayQueryValue) StringQueryValue(jakarta.nosql.query.StringQueryValue) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 7 with QueryValue

use of jakarta.nosql.query.QueryValue in project jnosql-diana by eclipse.

the class RemoveProviderTest method shouldReturnParserQuery3.

@ParameterizedTest(name = "Should parser the query {0}")
@ValueSource(strings = { "del -12" })
public void shouldReturnParserQuery3(String query) {
    DelQuery delQuery = provider.apply(query);
    List<QueryValue<?>> keys = delQuery.getKeys();
    assertEquals(1, keys.size());
    QueryValue<?> key = keys.get(0);
    assertTrue(key instanceof NumberQueryValue);
    assertEquals(-12L, NumberQueryValue.class.cast(key).get());
}
Also used : NumberQueryValue(jakarta.nosql.query.NumberQueryValue) DelQuery(jakarta.nosql.query.DelQuery) NumberQueryValue(jakarta.nosql.query.NumberQueryValue) QueryValue(jakarta.nosql.query.QueryValue) ArrayQueryValue(jakarta.nosql.query.ArrayQueryValue) StringQueryValue(jakarta.nosql.query.StringQueryValue) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 8 with QueryValue

use of jakarta.nosql.query.QueryValue in project jnosql-diana by eclipse.

the class RemoveProviderTest method shouldReturnParserQuery4.

@ParameterizedTest(name = "Should parser the query {0}")
@ValueSource(strings = { "del -12.12" })
public void shouldReturnParserQuery4(String query) {
    DelQuery delQuery = provider.apply(query);
    List<QueryValue<?>> keys = delQuery.getKeys();
    assertEquals(1, keys.size());
    QueryValue<?> key = keys.get(0);
    assertTrue(key instanceof NumberQueryValue);
    assertEquals(-12.12, NumberQueryValue.class.cast(key).get());
}
Also used : NumberQueryValue(jakarta.nosql.query.NumberQueryValue) DelQuery(jakarta.nosql.query.DelQuery) NumberQueryValue(jakarta.nosql.query.NumberQueryValue) QueryValue(jakarta.nosql.query.QueryValue) ArrayQueryValue(jakarta.nosql.query.ArrayQueryValue) StringQueryValue(jakarta.nosql.query.StringQueryValue) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 9 with QueryValue

use of jakarta.nosql.query.QueryValue in project jnosql-diana by eclipse.

the class GetProviderTest method shouldReturnParserQuery5.

@ParameterizedTest(name = "Should parser the query {0}")
@ValueSource(strings = { "get {1,12}" })
public void shouldReturnParserQuery5(String query) {
    GetQuery getQuery = queryProvider.apply(query);
    List<QueryValue<?>> keys = getQuery.getKeys();
    assertEquals(1, keys.size());
    QueryValue<?> key = keys.get(0);
    assertTrue(key instanceof ArrayQueryValue);
    QueryValue<?>[] values = ArrayQueryValue.class.cast(key).get();
    MatcherAssert.assertThat(Arrays.stream(values).map(QueryValue::get).collect(Collectors.toList()), Matchers.contains(1L, 12L));
}
Also used : GetQuery(jakarta.nosql.query.GetQuery) NumberQueryValue(jakarta.nosql.query.NumberQueryValue) QueryValue(jakarta.nosql.query.QueryValue) ArrayQueryValue(jakarta.nosql.query.ArrayQueryValue) StringQueryValue(jakarta.nosql.query.StringQueryValue) ArrayQueryValue(jakarta.nosql.query.ArrayQueryValue) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 10 with QueryValue

use of jakarta.nosql.query.QueryValue in project jnosql-diana by eclipse.

the class GetProviderTest method shouldReturnParserQuery2.

@ParameterizedTest(name = "Should parser the query {0}")
@ValueSource(strings = { "get 12.12" })
public void shouldReturnParserQuery2(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());
}
Also used : NumberQueryValue(jakarta.nosql.query.NumberQueryValue) GetQuery(jakarta.nosql.query.GetQuery) NumberQueryValue(jakarta.nosql.query.NumberQueryValue) QueryValue(jakarta.nosql.query.QueryValue) ArrayQueryValue(jakarta.nosql.query.ArrayQueryValue) StringQueryValue(jakarta.nosql.query.StringQueryValue) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

QueryValue (jakarta.nosql.query.QueryValue)22 ArrayQueryValue (jakarta.nosql.query.ArrayQueryValue)18 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)18 ValueSource (org.junit.jupiter.params.provider.ValueSource)18 StringQueryValue (jakarta.nosql.query.StringQueryValue)15 NumberQueryValue (jakarta.nosql.query.NumberQueryValue)14 ParamQueryValue (jakarta.nosql.query.ParamQueryValue)9 ConditionQueryValue (jakarta.nosql.query.ConditionQueryValue)7 Condition (jakarta.nosql.query.Condition)6 DelQuery (jakarta.nosql.query.DelQuery)6 GetQuery (jakarta.nosql.query.GetQuery)6 Where (jakarta.nosql.query.Where)6 FunctionQueryValue (jakarta.nosql.query.FunctionQueryValue)5 JSONQueryValue (jakarta.nosql.query.JSONQueryValue)5 Params (jakarta.nosql.Params)3 QueryException (jakarta.nosql.QueryException)3 DeleteQuery (jakarta.nosql.query.DeleteQuery)3 Function (jakarta.nosql.query.Function)3 SelectQuery (jakarta.nosql.query.SelectQuery)3 ValueType (jakarta.nosql.query.ValueType)3