1 /*** 2 * AssignOperatorTest.java 3 * 4 * $Author: mballesteros $ 5 * $Date: 2003/11/28 19:18:03 $ 6 * $Revision: 1.1 $ 7 */ 8 package net.sf.jec; 9 10 import java.util.HashMap; 11 12 import net.sf.jec.AccessorOperator; 13 import net.sf.jec.AssignOperator; 14 import net.sf.jec.ConstantOperator; 15 import net.sf.jec.EvaluationException; 16 import net.sf.jec.IndexerOperator; 17 import net.sf.jec.InvertibleOperator; 18 import net.sf.jec.Operator; 19 20 import junit.framework.TestCase; 21 22 /*** 23 * @author mballesteros 24 */ 25 public class AssignOperatorTest extends TestCase { 26 27 /*** 28 * Constructor for AssignOperatorTest. 29 * @param arg0 30 */ 31 public AssignOperatorTest(String arg0) { 32 super(arg0); 33 } 34 35 private HashMap ctx; 36 private Book book; 37 38 /* 39 * @see TestCase#setUp() 40 */ 41 protected void setUp() throws Exception { 42 super.setUp(); 43 book = Book.getExample(); 44 ctx = new HashMap(); 45 ctx.put("book", book); 46 ctx.put("intIndex", "0"); 47 ctx.put("strIndex", "1"); 48 } 49 50 51 public void testApply() throws EvaluationException { 52 Operator op; 53 op = new AccessorOperator("book", false); 54 op = new AccessorOperator("pages", op, false); 55 op = new IndexerOperator(new ConstantOperator(new Integer(0)), op, false); 56 op = new AccessorOperator("paragraphs", op, false); 57 op = new IndexerOperator(new ConstantOperator(new Integer(0)), op, false); 58 InvertibleOperator iop = new AccessorOperator("text", op, false); 59 60 ConstantOperator cop = new ConstantOperator("Nuevo texto"); 61 62 AssignOperator aop = new AssignOperator(iop, cop, false); 63 aop.apply(ctx, ctx); 64 assertEquals("Nuevo texto", iop.apply(ctx, ctx)); 65 } 66 67 }

This page was automatically generated by Maven