1 package org.drools.reteoo.impl; 2 3 import org.drools.rule.Declaration; 4 import org.drools.semantics.java.ClassObjectType; 5 6 import junit.framework.TestCase; 7 8 import java.util.Set; 9 10 public class ParameterTupleTest extends TestCase 11 { 12 private Declaration decl; 13 private Declaration otherDecl; 14 15 public ParameterTupleTest(String name) 16 { 17 super( name ); 18 } 19 20 public void setUp() 21 { 22 this.decl = new Declaration( new ClassObjectType( Object.class ), 23 "decl" ); 24 25 this.otherDecl = new Declaration( new ClassObjectType( Object.class ), 26 "otherDecl" ); 27 } 28 29 public void tearDown() 30 { 31 this.decl = null; 32 } 33 34 public void testConstruct() 35 { 36 Object obj = new Object(); 37 38 ParameterTuple tuple = new ParameterTuple( this.decl, 39 obj ); 40 } 41 42 public void testGetParameterObject() 43 { 44 Object obj = new Object(); 45 46 ParameterTuple tuple = new ParameterTuple( this.decl, 47 obj ); 48 49 assertSame( obj, 50 tuple.getParameterObject() ); 51 } 52 53 public void testGetParameterDeclaration() 54 { 55 Object obj = new Object(); 56 57 ParameterTuple tuple = new ParameterTuple( this.decl, 58 obj ); 59 60 assertSame( this.decl, 61 tuple.getParameterDeclaration() ); 62 } 63 64 public void testGetDeclarations() 65 { 66 Object obj = new Object(); 67 68 ParameterTuple tuple = new ParameterTuple( this.decl, 69 obj ); 70 Set decls = tuple.getDeclarations(); 71 72 assertEquals( 1, 73 decls.size() ); 74 75 assertTrue( decls.contains( this.decl ) ); 76 } 77 78 public void testGet() 79 { 80 Object obj = new Object(); 81 82 ParameterTuple tuple = new ParameterTuple( this.decl, 83 obj ); 84 85 86 Object otherObj = new Object(); 87 88 tuple.putOtherColumn( this.otherDecl, 89 otherObj ); 90 91 assertSame( obj, 92 tuple.get( this.decl ) ); 93 94 assertSame( otherObj, 95 tuple.get( this.otherDecl ) ); 96 97 } 98 }

This page was automatically generated by Maven