use of org.jnosql.artemis.model.Person in project jnosql-artemis by eclipse.
the class ColumnRepositoryProxyTest method shouldFindByAgeLessEqual.
@Test
public void shouldFindByAgeLessEqual() {
Person ada = Person.builder().withAge(20).withName("Ada").build();
when(template.select(any(ColumnQuery.class))).thenReturn(singletonList(ada));
personRepository.findByAgeLessThan(33);
ArgumentCaptor<ColumnQuery> captor = ArgumentCaptor.forClass(ColumnQuery.class);
verify(template).select(captor.capture());
ColumnQuery query = captor.getValue();
ColumnCondition condition = query.getCondition().get();
assertEquals("Person", query.getColumnFamily());
assertEquals(LESSER_THAN, condition.getCondition());
assertEquals(Column.of("age", 33), condition.getColumn());
}
use of org.jnosql.artemis.model.Person in project jnosql-artemis by eclipse.
the class DefaultColumnMapperDeleteBuilderTest method shouldSelectWhereNameAnd.
@Test
public void shouldSelectWhereNameAnd() {
ColumnDeleteQuery query = mapperBuilder.deleteFrom(Person.class).where("age").between(10, 20).and("name").eq("Ada").build();
ColumnDeleteQuery queryExpected = delete().from("Person").where("age").between(10, 20).and("name").eq("Ada").build();
assertEquals(queryExpected, query);
}
use of org.jnosql.artemis.model.Person in project jnosql-artemis by eclipse.
the class DefaultColumnMapperDeleteBuilderTest method shouldSelectWhereNameGte.
@Test
public void shouldSelectWhereNameGte() {
ColumnDeleteQuery query = mapperBuilder.deleteFrom(Person.class).where("id").gte(10).build();
ColumnDeleteQuery queryExpected = delete().from("Person").where("_id").gte(10L).build();
assertEquals(queryExpected, query);
}
use of org.jnosql.artemis.model.Person in project jnosql-artemis by eclipse.
the class DefaultColumnMapperDeleteBuilderTest method shouldSelectWhereNameLt.
@Test
public void shouldSelectWhereNameLt() {
ColumnDeleteQuery query = mapperBuilder.deleteFrom(Person.class).where("id").lt(10).build();
ColumnDeleteQuery queryExpected = delete().from("Person").where("_id").lt(10L).build();
assertEquals(queryExpected, query);
}
use of org.jnosql.artemis.model.Person in project jnosql-artemis by eclipse.
the class DefaultColumnMapperDeleteBuilderTest method shouldSelectWhereNameGt.
@Test
public void shouldSelectWhereNameGt() {
ColumnDeleteQuery query = mapperBuilder.deleteFrom(Person.class).where("id").gt(10).build();
ColumnDeleteQuery queryExpected = delete().from("Person").where("_id").gt(10L).build();
assertEquals(queryExpected, query);
}
Aggregations