use of org.apache.jena.query.Query in project jena by apache.
the class ConstructHandlerTest method setup.
@Before
public void setup() {
query = new Query();
handler = new ConstructHandler(query);
}
use of org.apache.jena.query.Query in project jena by apache.
the class ExprFactoryTest method existsTest.
// expr op
@Test
public void existsTest() {
WhereHandler handler = new WhereHandler(new Query());
WhereClause<?> whereClause = mock(WhereClause.class);
when(whereClause.getWhereHandler()).thenReturn(handler);
Expr e = factory.exists(whereClause);
assertTrue(e instanceof E_Exists);
}
use of org.apache.jena.query.Query in project jena by apache.
the class ExprFactoryTest method notexistsTest.
@Test
public void notexistsTest() {
WhereHandler handler = new WhereHandler(new Query());
WhereClause<?> whereClause = mock(WhereClause.class);
when(whereClause.getWhereHandler()).thenReturn(handler);
Expr e = factory.notexists(whereClause);
assertTrue(e instanceof E_NotExists);
}
use of org.apache.jena.query.Query in project jena by apache.
the class SelectClauseTest method testAddVarVar.
@ContractTest
public void testAddVarVar() throws Exception {
Var v = Var.alloc("one");
SelectClause<?> selectClause = getProducer().newInstance();
Query query = getQuery(selectClause.addVar(v));
VarExprList expr = query.getProject();
assertEquals(1, expr.size());
assertTrue(expr.contains(v));
}
use of org.apache.jena.query.Query in project jena by apache.
the class SelectBuilderTest method setDistinctTest.
@Test
public void setDistinctTest() throws Exception {
Query query = builder.query;
assertFalse(query.isDistinct());
assertFalse(query.isReduced());
query = builder.setDistinct(true).query;
assertTrue(query.isDistinct());
assertFalse(query.isReduced());
query = builder.setReduced(false).query;
assertTrue(query.isDistinct());
assertFalse(query.isReduced());
query = builder.setReduced(true).query;
assertFalse(query.isDistinct());
assertTrue(query.isReduced());
query = builder.setDistinct(true).query;
assertTrue(query.isDistinct());
assertFalse(query.isReduced());
query = builder.setDistinct(false).query;
assertFalse(query.isDistinct());
assertFalse(query.isReduced());
}
Aggregations