Search in sources :

Example 6 with Operator

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

the class DeleteByMethodQueryProviderTest method shouldReturnParserQuery11.

@ParameterizedTest(name = "Should parser the query {0}")
@ValueSource(strings = { "deleteByAgeNotLessThanEqual" })
public void shouldReturnParserQuery11(String query) {
    Operator operator = Operator.LESSER_EQUALS_THAN;
    String variable = "age";
    checkNotCondition(query, operator, variable);
}
Also used : Operator(jakarta.nosql.query.Operator) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 7 with Operator

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

the class DeleteByMethodQueryProviderTest method shouldReturnParserQuery16.

@ParameterizedTest(name = "Should parser the query {0}")
@ValueSource(strings = { "deleteByAgeAndName" })
public void shouldReturnParserQuery16(String query) {
    Operator operator = Operator.EQUALS;
    Operator operator2 = Operator.EQUALS;
    String variable = "age";
    String variable2 = "name";
    Operator operatorAppender = Operator.AND;
    checkAppendCondition(query, operator, operator2, variable, variable2, operatorAppender);
}
Also used : Operator(jakarta.nosql.query.Operator) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 8 with Operator

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

the class DeleteByMethodQueryProviderTest method shouldReturnParserQuery12.

@ParameterizedTest(name = "Should parser the query {0}")
@ValueSource(strings = { "deleteByAgeLike" })
public void shouldReturnParserQuery12(String query) {
    Operator operator = Operator.LIKE;
    String variable = "age";
    checkCondition(query, operator, variable);
}
Also used : Operator(jakarta.nosql.query.Operator) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 9 with Operator

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

the class DeleteByMethodQueryProviderTest method shouldReturnParserQuery7.

@ParameterizedTest(name = "Should parser the query {0}")
@ValueSource(strings = { "deleteByAgeNotGreaterThanEqual" })
public void shouldReturnParserQuery7(String query) {
    Operator operator = Operator.GREATER_EQUALS_THAN;
    String variable = "age";
    checkNotCondition(query, operator, variable);
}
Also used : Operator(jakarta.nosql.query.Operator) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 10 with Operator

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

the class DeleteByMethodQueryProviderTest method shouldReturnParserQuery27.

@ParameterizedTest(name = "Should parser the query {0}")
@ValueSource(strings = { "deleteByAgeBetween" })
public void shouldReturnParserQuery27(String query) {
    Operator operator = Operator.BETWEEN;
    String entity = "entity";
    DeleteQuery deleteQuery = queryProvider.apply(query, entity);
    assertNotNull(deleteQuery);
    assertEquals(entity, deleteQuery.getEntity());
    assertTrue(deleteQuery.getFields().isEmpty());
    Optional<Where> where = deleteQuery.getWhere();
    assertTrue(where.isPresent());
    Condition condition = where.get().getCondition();
    QueryValue<?> value = condition.getValue();
    assertEquals(operator, condition.getOperator());
    QueryValue<?>[] values = MethodArrayValue.class.cast(value).get();
    ParamQueryValue param1 = (ParamQueryValue) values[0];
    ParamQueryValue param2 = (ParamQueryValue) values[1];
    assertNotEquals(param2.get(), param1.get());
}
Also used : Operator(jakarta.nosql.query.Operator) Condition(jakarta.nosql.query.Condition) ParamQueryValue(jakarta.nosql.query.ParamQueryValue) DeleteQuery(jakarta.nosql.query.DeleteQuery) Where(jakarta.nosql.query.Where) ParamQueryValue(jakarta.nosql.query.ParamQueryValue) ConditionQueryValue(jakarta.nosql.query.ConditionQueryValue) QueryValue(jakarta.nosql.query.QueryValue) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

Operator (jakarta.nosql.query.Operator)43 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)34 ValueSource (org.junit.jupiter.params.provider.ValueSource)34 Condition (jakarta.nosql.query.Condition)3 ConditionQueryValue (jakarta.nosql.query.ConditionQueryValue)3 ParamQueryValue (jakarta.nosql.query.ParamQueryValue)2 QueryValue (jakarta.nosql.query.QueryValue)2 Where (jakarta.nosql.query.Where)2 ArrayQueryValue (jakarta.nosql.query.ArrayQueryValue)1 DeleteQuery (jakarta.nosql.query.DeleteQuery)1 SelectQuery (jakarta.nosql.query.SelectQuery)1