### Question:
LogicalPlan extends TreeNode implements QueryItemInterface { public Query getQuery() { return query; } LogicalPlan(String description); TreeNode getCurrentNode(); void setCurrentNode(TreeNode currentNode); Query getQuery(); void setQuery(Query query); CreateFunction getCreateFunction(); void setCreateFunction(CreateFunction createFunction); ClassName getClassName(); void setClassName(ClassName className); Insert getInsert(); void setInsert(Insert insert); CallFunction getCallFunction(); void setCallFunction(CallFunction callFunction); CreateAsset getCreateAsset(); void setCreateAsset(CreateAsset createAsset); DeleteFunction getDeleteFunction(); void setDeleteFunction(DeleteFunction deleteFunction); DropAsset getDropAsset(); void setDropAsset(DropAsset dropAsset); UpgradeFunction getUpgradeFunction(); void setSmartCnrtDeploy(SmartCnrtDeploy smartCnrtDeploy); SmartCnrtDeploy getSmartCnrtDeploy(); void setUpgradeFunction(UpgradeFunction upgradeFunction); void setCreateUser(CreateUser createUser); CreateUser getCreateUser(); SQLType getType(); void setType(SQLType type); @Override Object clone();  }### Answer:
@Test public void testSimpleIsNotNULL() { String sql = "SELECT blocknumber,hash,transactions FROM block WHERE (hash IS NOT NULL) AND (blocknumber IS NOT NULL) AND (blocknumber > 123) AND (blocknumber < 145) AND (hash = '2f32268b02c2d498c926401f6e74406525c02f735feefe457c5689')"; LogicalPlan plan = getLogicalPlan(sql); plan.getQuery().traverse(); }
@Test public void testSimpleSelect() { String sql = "select a, b from TRANSACTION t"; LogicalPlan plan = getLogicalPlan(sql); LogicalPlan logicalPlan = buildSimpleSelect(); assertTrue(logicalPlan.getQuery().equals(plan.getQuery())); }
@Test public void testPlaceHolder() { String sql = "select count(*) as cnt, blocknumber from transaction where blocknumber = ? group by blocknumber"; LogicalPlan plan = getLogicalPlan(sql); plan.getQuery().traverse(); TreeNode node = plan.getQuery().getChildType(WhereClause.class, 0).getChildType(FilterItem.class, 0); assertTrue(node.hasChildType(Placeholder.class)); }
@Test public void testSimpleSelectWithWhereClause() { String sql = "select a, b from TRANSACTION t where a = 'hello world'"; LogicalPlan plan = getLogicalPlan(sql); LogicalPlan logicalPlan = buildSelectWithWhere(); assertTrue(logicalPlan.getQuery().equals(plan.getQuery())); }
@Test public void testSimpleSelectWithWhereClauseAndGroupBy() { String sql = "select a, b from TRANSACTION t where a = 'hello world' group by c"; LogicalPlan plan = getLogicalPlan(sql); LogicalPlan logicalPlan = buildSelectWithGroupBy(); assertTrue(logicalPlan.getQuery().equals(plan.getQuery())); }
@Test public void testSelectWithHaving() { String sql = "select a, b from TRANSACTION t where a = 'hello world' group by c having b > 100"; LogicalPlan plan = getLogicalPlan(sql); LogicalPlan logicalPlan = buildHaving(); assertTrue(logicalPlan.getQuery().equals(plan.getQuery())); }
@Test public void testSelectWithHavingAndOrderBy() { String sql = "select a, b from TRANSACTION t where a = 'hello world' group by c having b > 100 order by b desc"; LogicalPlan plan = getLogicalPlan(sql); LogicalPlan logicalPlan = buildOrderByClause(); assertTrue(logicalPlan.getQuery().equals(plan.getQuery())); }