use of jakarta.nosql.column.Column in project jnosql-diana by eclipse.
the class ColumnTest method shouldCreateAnColumnInstance.
@Test
public void shouldCreateAnColumnInstance() {
String name = "name";
Column column = Column.of(name, DEFAULT_VALUE);
assertNotNull(column);
assertEquals(name, column.getName());
assertEquals(DEFAULT_VALUE, column.getValue());
}
use of jakarta.nosql.column.Column in project jnosql-diana by eclipse.
the class DefaultColumnConditionTest method shouldCreateAnInstance.
@Test
public void shouldCreateAnInstance() {
Column name = Column.of("name", "Otavio");
ColumnCondition condition = DefaultColumnCondition.of(name, Condition.EQUALS);
assertNotNull(condition);
assertEquals(name, condition.getColumn());
assertEquals(Condition.EQUALS, condition.getCondition());
}
use of jakarta.nosql.column.Column in project jnosql-diana by eclipse.
the class DefaultColumnConditionTest method shouldCreateAndCondition.
@Test
public void shouldCreateAndCondition() {
Column age = Column.of("age", 26);
Column name = Column.of("name", "Otavio");
ColumnCondition condition1 = DefaultColumnCondition.of(name, Condition.EQUALS);
ColumnCondition condition2 = DefaultColumnCondition.of(age, Condition.GREATER_THAN);
ColumnCondition and = condition1.and(condition2);
Column andColumn = and.getColumn();
assertEquals(Condition.AND, and.getCondition());
assertEquals(Condition.AND.getNameField(), andColumn.getName());
assertThat(andColumn.getValue().get(new TypeReference<List<ColumnCondition>>() {
}), Matchers.containsInAnyOrder(condition1, condition2));
}
use of jakarta.nosql.column.Column in project jnosql-diana by eclipse.
the class DefaultColumnConditionTest method shouldCreateNegationCondition.
@Test
public void shouldCreateNegationCondition() {
Column age = Column.of("age", 26);
ColumnCondition condition = DefaultColumnCondition.of(age, Condition.GREATER_THAN);
ColumnCondition negate = condition.negate();
Column negateColumn = negate.getColumn();
assertEquals(Condition.NOT, negate.getCondition());
assertEquals(Condition.NOT.getNameField(), negateColumn.getName());
assertEquals(DefaultColumnCondition.of(age, Condition.GREATER_THAN), negateColumn.getValue().get());
}
use of jakarta.nosql.column.Column in project jnosql-diana by eclipse.
the class DefaultColumnConditionTest method shouldCreateOrCondition.
@Test
public void shouldCreateOrCondition() {
Column age = Column.of("age", 26);
Column name = Column.of("name", "Otavio");
ColumnCondition condition1 = DefaultColumnCondition.of(name, Condition.EQUALS);
ColumnCondition condition2 = DefaultColumnCondition.of(age, Condition.GREATER_THAN);
ColumnCondition and = condition1.or(condition2);
Column andColumn = and.getColumn();
assertEquals(Condition.OR, and.getCondition());
assertEquals(Condition.OR.getNameField(), andColumn.getName());
assertThat(andColumn.getValue().get(new TypeReference<List<ColumnCondition>>() {
}), Matchers.containsInAnyOrder(condition1, condition2));
}
Aggregations