use of org.jnosql.diana.api.TypeReference in project jnosql-diana by eclipse.
the class DocumentTest method shouldReturnGetType.
@Test
public void shouldReturnGetType() {
Value value = Value.of("text");
Document document = Document.of("name", value);
TypeReference<List<String>> typeReference = new TypeReference<List<String>>() {
};
assertEquals(value.get(typeReference), document.get(typeReference));
}
use of org.jnosql.diana.api.TypeReference in project jnosql-diana by eclipse.
the class DefaultDeleteQueryBuilderTest method shouldSelectWhereNameBetween.
@Test
public void shouldSelectWhereNameBetween() {
String documentCollection = "documentCollection";
Number valueA = 10;
Number valueB = 20;
DocumentDeleteQuery query = delete().from(documentCollection).where("name").between(valueA, valueB).build();
DocumentCondition condition = query.getCondition().get();
Document document = condition.getDocument();
assertTrue(query.getDocuments().isEmpty());
assertEquals(documentCollection, query.getDocumentCollection());
assertEquals(Condition.BETWEEN, condition.getCondition());
assertEquals("name", document.getName());
assertThat(document.get(new TypeReference<List<Number>>() {
}), Matchers.contains(10, 20));
}
use of org.jnosql.diana.api.TypeReference in project jnosql-diana by eclipse.
the class DefaultDeleteQueryBuilderTest method shouldSelectWhereNameBetween.
@Test
public void shouldSelectWhereNameBetween() {
String columnFamily = "columnFamily";
Number valueA = 10;
Number valueB = 20;
ColumnDeleteQuery query = delete().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.TypeReference 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.TypeReference in project jnosql-diana by eclipse.
the class ColumnTest method shouldReturnGetType.
@Test
public void shouldReturnGetType() {
Value value = Value.of("text");
Column column = Column.of("name", value);
TypeReference<List<String>> typeReference = new TypeReference<List<String>>() {
};
assertEquals(value.get(typeReference), column.get(typeReference));
}
Aggregations