BooleanEvaluator evaluator = new BooleanEvaluator( symbols );
BooleanEvaluator evaluator = new BooleanEvaluator( symbols, variables );
	public void testEvaluateTerm() throws PreprocessException {		HashMap symbols = new HashMap();		symbols.put( "test1", Boolean.TRUE );		symbols.put( "test2", Boolean.TRUE );		symbols.put( "sym-1", Boolean.TRUE );		symbols.put( "sym-2", Boolean.TRUE );		symbols.put( "var-1:defined", Boolean.TRUE );		symbols.put( "var-2:defined", Boolean.TRUE );		symbols.put( "polish.midp1", Boolean.TRUE );		symbols.put( "polish.midp2", Boolean.TRUE );				BooleanEvaluator evaluator = new BooleanEvaluator( symbols );		String term = "test1 ||  test2";		assertTrue( evaluator.evaluateTerm( term, "MyClass", 12) );		term = "test1 &&  test2";		assertTrue( evaluator.evaluateTerm( term, "MyClass", 12) );		term = "test1 ^  test2";		assertFalse( evaluator.evaluateTerm( term, "MyClass", 12) );				term = "test1 ||  test2 || test3";		assertTrue( evaluator.evaluateTerm( term, "MyClass", 12) );		term = "test1 &&  test2 || test3";		assertTrue( evaluator.evaluateTerm( term, "MyClass", 12) );		term = "test1 ^  test2  || test3";		assertFalse( evaluator.evaluateTerm( term, "MyClass", 12) );				term = "sym-1 ||  sym-2";		assertTrue( evaluator.evaluateTerm( term, "MyClass", 12) );		term = "sym-1 &&  sym-2";		assertTrue( evaluator.evaluateTerm( term, "MyClass", 12) );		term = "sym-1 ^  sym-2";		assertFalse( evaluator.evaluateTerm( term, "MyClass", 12) );				term = "var-1:defined ||  var-2:defined";		assertTrue( evaluator.evaluateTerm( term, "MyClass", 12) );		term = "var-1:defined &&  var-2:defined";		assertTrue( evaluator.evaluateTerm( term, "MyClass", 12) );		term = "var-1:defined ^  var-2:defined";		assertFalse( evaluator.evaluateTerm( term, "MyClass", 12) );				term = "polish.midp1 ||  polish.midp2";		assertTrue( evaluator.evaluateTerm( term, "MyClass", 12) );		term = "polish.midp1 &&  polish.midp2";		assertTrue( evaluator.evaluateTerm( term, "MyClass", 12) );		term = "polish.midp1 ^  polish.midp2";		assertFalse( evaluator.evaluateTerm( term, "MyClass", 12) );		term = "polish.midp1";		assertTrue( evaluator.evaluateTerm( term, "MyClass", 12) );				term = "true ||  true";		assertTrue( evaluator.evaluateTerm( term, "MyClass", 12) );		term = "false ||  true";		assertTrue( evaluator.evaluateTerm( term, "MyClass", 12) );		term = "true ||  false";		assertTrue( evaluator.evaluateTerm( term, "MyClass", 12) );		term = "false ||  false";		assertFalse( evaluator.evaluateTerm( term, "MyClass", 12) );		term = "! false ||  false";		assertTrue( evaluator.evaluateTerm( term, "MyClass", 12) );		term = "false || ! false";		assertTrue( evaluator.evaluateTerm( term, "MyClass", 12) );		term = "!false || !false";		assertTrue( evaluator.evaluateTerm( term, "MyClass", 12) );		term = "true &&  true";		assertTrue( evaluator.evaluateTerm( term, "MyClass", 12) );		term = "true &&  false";		assertFalse( evaluator.evaluateTerm( term, "MyClass", 12) );		term = "false &&  true";		assertFalse( evaluator.evaluateTerm( term, "MyClass", 12) );		term = "true ^  true";		assertFalse( evaluator.evaluateTerm( term, "MyClass", 12) );		term = "true ^  false";		assertTrue( evaluator.evaluateTerm( term, "MyClass", 12) );		term = "false ^  true";		assertTrue( evaluator.evaluateTerm( term, "MyClass", 12) );		term = "false ^  !false";		assertTrue( evaluator.evaluateTerm( term, "MyClass", 12) );		term = "false ^  false";		assertFalse( evaluator.evaluateTerm( term, "MyClass", 12) );		term = "false ^  !false || false && true";		assertTrue( evaluator.evaluateTerm( term, "MyClass", 12) );		term = "false ^  !false || !false  &&  !  false";		assertTrue( evaluator.evaluateTerm( term, "MyClass", 12) );						// test invalid terms:		term = "test1 test2";		try {			evaluator.evaluateTerm( term, "MyClass", 12 );			fail( "evaluation of term [" + term + "] should fail.");		} catch (PreprocessException e) {			// expected behaviour!		}				term = "test1 && test2 ||";		try {			evaluator.evaluateTerm( term, "MyClass", 12 );			fail( "evaluation of term [" + term + "] should fail.");		} catch (PreprocessException e) {			// expected behaviour!		}				term = "&& test1 && test2";		try {			evaluator.evaluateTerm( term, "MyClass", 12 );			fail( "evaluation of term [" + term + "] should fail.");		} catch (PreprocessException e) {			// expected behaviour!		}				term = "test1 && || test2";		try {			evaluator.evaluateTerm( term, "MyClass", 12 );			fail( "evaluation of term [" + term + "] should fail.");		} catch (PreprocessException e) {			// expected behaviour!		}				term = "test1 && (test2 || test3";		try {			evaluator.evaluateTerm( term, "MyClass", 12 );			fail( "evaluation of term [" + term + "] should fail.");		} catch (PreprocessException e) {			// expected behaviour!		}				term = "test1 && test2 !) || test3";		try {			evaluator.evaluateTerm( term, "MyClass", 12 );			fail( "evaluation of term [" + term + "] should fail.");		} catch (PreprocessException e) {			// expected behaviour!		}		term = "test1 && test2 ! || test3";		try {			evaluator.evaluateTerm( term, "MyClass", 12 );			fail( "evaluation of term [" + term + "] should fail.");		} catch (PreprocessException e) {			// expected behaviour!		}				term = "test1 &! test2 || test3";		try {			evaluator.evaluateTerm( term, "MyClass", 12 );			fail( "evaluation of term [" + term + "] should fail.");		} catch (PreprocessException e) {			// expected behaviour!		}	}