1 /*
2 * Copyright (c) 2002-2003 The XDoclet Team.
3 * All rights reserved.
4 */
5
6 package xdoclet.util.predicates;
7
8 import junit.framework.TestCase;
9
10 /***
11 * @version $Revision: 1.4 $
12 * @author <a href="mailto:mbo@jcs.be">Mathias Bogaert</a>
13 */
14 public class NotTest extends TestCase {
15 public NotTest(String s) {
16 super(s);
17 }
18
19 public void testNot() {
20 Not notTrue = new Not();
21 notTrue.add(new True());
22 assertTrue(!notTrue.evaluate(null));
23
24 Not notFalse = new Not();
25 notFalse.add(new False());
26 assertTrue(notFalse.evaluate(null));
27 }
28
29 /***
30 * Test if Not is an Unary orperator
31 */
32 public void testUnarity() {
33 try {
34 Not notTest = new Not();
35 notTest.add(new True());
36 notTest.add(new False());
37 notTest.evaluate(null);
38 // Even a step above an exception should be thrown
39 fail("Not is an unary operation and must not allow two children");
40 } catch (Exception e) {
41 // Good
42 }
43 }
44 }
This page was automatically generated by Maven