/*
(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;
public class TestUnless
{
@Test public void ensureUnlessExposesArguments()
{
Element e = new Elements();
Unless u = new Unless( "myName", e );
assertSame( e, u.getElement() );
assertEquals( "myName", u.getName() );
}
static class VisitUnless extends TestElement.VisitElement
{
@Override public void visitUnless( Unless u )
{ seen.set( u ); }
}
@Test public void ensureUnlessVisitInvokesVisitUnless()
{
Unless u = new Unless( "theName", new Elements() );
VisitElement v = new VisitUnless();
u.visit( v );
assertSame( u, v.seen.get() );
}
}