Package com.hp.jena.rules.ast.tests

Source Code of com.hp.jena.rules.ast.tests.TestLet$VisitLet

/*
  (c) Copyright 2008, 2009 Hewlett-Packard Development Company, LP
   All rights reserved.
   $Id$
*/

package com.hp.jena.rules.ast.tests;

import static org.junit.Assert.*;

import org.junit.Test;

import com.hp.jena.rules.ast.*;
import com.hp.jena.rules.ast.tests.TestElement.VisitElement;
import com.hp.jena.shared.Ref;

public class TestLet
    {
    @Test public void ensureLetExposesFields()
        {
        Expr e = new Expr( "someFunction" );
        Item name = Item.createVariable( "x" );
        assertSame( e, new Let( name, e ).getExpr() );
        assertSame( name, new Let( name, e ).getName() );
        }
   
    static class VisitLet extends TestElement.VisitElement
        {
        @Override public void visitLet( Let let )
            { seen.set( let ); }
        }
   
    @Test public void ensureLetVisitInvokesVisitFilter()
        {
        Expr e = new Expr( "someFunction" );
        Item name = Item.createVariable( "x" );
        Ref<Element> seen = new Ref<Element>();
        VisitElement v = new VisitLet();
        Let l = new Let( name, e );
        l.visit( v );
        assertSame( l, v.seen.get() );
        }
    }
TOP

Related Classes of com.hp.jena.rules.ast.tests.TestLet$VisitLet

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.