author | Jaroslav Tulach <jtulach@netbeans.org> |
Sat, 14 Jun 2008 09:59:16 +0200 | |
changeset 176 | 0f658628beac |
child 177 | 67d6dceb1002 |
permissions | -rw-r--r-- |
jtulach@176 | 1 |
package org.apidesign.test.visitor; |
jtulach@176 | 2 |
|
jtulach@176 | 3 |
import org.apidesign.test.visitor.PrintTest.PrintVisitor; |
jtulach@176 | 4 |
import static junit.framework.Assert.*; |
jtulach@176 | 5 |
import org.apidesign.visitor.notevolutionready.Language.Expression; |
jtulach@176 | 6 |
import org.apidesign.visitor.notevolutionready.Language.Minus; |
jtulach@176 | 7 |
import org.apidesign.visitor.notevolutionready.Language.Number; |
jtulach@176 | 8 |
import org.apidesign.visitor.notevolutionready.Language.Plus; |
jtulach@176 | 9 |
import org.apidesign.visitor.notevolutionready.Language.Visitor; |
jtulach@176 | 10 |
import org.junit.Test; |
jtulach@176 | 11 |
|
jtulach@176 | 12 |
public class PrintOfMinusStructureTest { |
jtulach@176 | 13 |
@Test public void printOneMinusTwo() { |
jtulach@176 | 14 |
// BEGIN: visitor.notevolutionready.oldwithnew |
jtulach@176 | 15 |
Number one = new Number(1); |
jtulach@176 | 16 |
Number two = new Number(2); |
jtulach@176 | 17 |
Expression plus = new Minus(one, two); |
jtulach@176 | 18 |
|
jtulach@176 | 19 |
PrintVisitor print = new PrintVisitor(); |
jtulach@176 | 20 |
plus.visit(print); // fails with AbstractMethodError |
jtulach@176 | 21 |
|
jtulach@176 | 22 |
assertEquals("1 - 2", print.sb.toString()); |
jtulach@176 | 23 |
// END: visitor.notevolutionready.oldwithnew |
jtulach@176 | 24 |
} |
jtulach@176 | 25 |
} |