use of org.jnosql.diana.api.column.ColumnCondition in project jnosql-diana by eclipse.
the class DefaultDeleteQueryBuilderTest method shouldSelectWhereNameLt.
@Test
public void shouldSelectWhereNameLt() {
String columnFamily = "columnFamily";
Number value = 10;
ColumnDeleteQuery query = delete().from(columnFamily).where("name").lt(value).build();
ColumnCondition columnCondition = query.getCondition().get();
Column column = columnCondition.getColumn();
assertTrue(query.getColumns().isEmpty());
assertEquals(columnFamily, query.getColumnFamily());
assertEquals(Condition.LESSER_THAN, columnCondition.getCondition());
assertEquals("name", column.getName());
assertEquals(value, column.get());
}
use of org.jnosql.diana.api.column.ColumnCondition in project jnosql-diana by eclipse.
the class DefaultSelectQueryBuilderTest method shouldSelectWhereNameLike.
@Test
public void shouldSelectWhereNameLike() {
String columnFamily = "columnFamily";
String name = "Ada Lovelace";
ColumnQuery query = select().from(columnFamily).where("name").like(name).build();
ColumnCondition condition = query.getCondition().get();
Column column = condition.getColumn();
assertTrue(query.getColumns().isEmpty());
assertEquals(columnFamily, query.getColumnFamily());
assertEquals(Condition.LIKE, condition.getCondition());
assertEquals("name", column.getName());
assertEquals(name, column.get());
}
use of org.jnosql.diana.api.column.ColumnCondition in project jnosql-diana by eclipse.
the class DefaultSelectQueryBuilderTest method shouldSelectWhereNameLt.
@Test
public void shouldSelectWhereNameLt() {
String columnFamily = "columnFamily";
Number value = 10;
ColumnQuery query = select().from(columnFamily).where("name").lt(value).build();
ColumnCondition condition = query.getCondition().get();
Column column = condition.getColumn();
assertTrue(query.getColumns().isEmpty());
assertEquals(columnFamily, query.getColumnFamily());
assertEquals(Condition.LESSER_THAN, condition.getCondition());
assertEquals("name", column.getName());
assertEquals(value, column.get());
}
use of org.jnosql.diana.api.column.ColumnCondition in project jnosql-diana by eclipse.
the class DefaultSelectQueryBuilderTest method shouldSelectWhereNameBetween.
@Test
public void shouldSelectWhereNameBetween() {
String columnFamily = "columnFamily";
Number valueA = 10;
Number valueB = 20;
ColumnQuery query = select().from(columnFamily).where("name").between(valueA, valueB).build();
ColumnCondition condition = query.getCondition().get();
Column column = condition.getColumn();
assertTrue(query.getColumns().isEmpty());
assertEquals(columnFamily, query.getColumnFamily());
assertEquals(Condition.BETWEEN, condition.getCondition());
assertEquals("name", column.getName());
assertThat(column.get(new TypeReference<List<Number>>() {
}), Matchers.contains(10, 20));
}
use of org.jnosql.diana.api.column.ColumnCondition in project jnosql-diana by eclipse.
the class DefaultSelectQueryBuilderTest method shouldSelectWhereNameLte.
@Test
public void shouldSelectWhereNameLte() {
String columnFamily = "columnFamily";
Number value = 10;
ColumnQuery query = select().from(columnFamily).where("name").lte(value).build();
ColumnCondition condition = query.getCondition().get();
Column column = condition.getColumn();
assertTrue(query.getColumns().isEmpty());
assertEquals(columnFamily, query.getColumnFamily());
assertEquals(Condition.LESSER_EQUALS_THAN, condition.getCondition());
assertEquals("name", column.getName());
assertEquals(value, column.get());
}
Aggregations