1 package org.jacorb.test.notification.node; 2 3 23 24 import junit.framework.Test; 25 import junit.framework.TestCase; 26 import junit.framework.TestSuite; 27 import org.jacorb.notification.filter.EvaluationResult; 28 29 34 35 public class EvaluationResultTest extends TestCase 36 { 37 38 private EvaluationResult objectUnderTest_; 39 40 public void setUp() throws Exception 41 { 42 objectUnderTest_ = new EvaluationResult(); 43 } 44 45 public void testPlus() throws Exception 46 { 47 EvaluationResult a, b; 48 a = new EvaluationResult(); 49 b = new EvaluationResult(); 50 51 a.setLong(10); 52 b.setLong(10); 53 54 EvaluationResult c = EvaluationResult.plus(a, b); 55 assertTrue(20 == c.getLong()); 56 57 a.setFloat(10); 58 b.setFloat(10); 59 60 assertTrue(a.isFloat()); 61 assertTrue(b.isFloat()); 62 63 c = EvaluationResult.plus(a, b); 64 assertTrue(20 == c.getFloat()); 65 assertTrue(c.isFloat()); 66 } 67 68 public void testSetString() throws Exception 69 { 70 objectUnderTest_.setString("hallo"); 71 assertEquals("hallo", objectUnderTest_.getString()); 72 } 73 74 public void testSetInt() throws Exception 75 { 76 objectUnderTest_.setLong(1); 77 assertTrue(objectUnderTest_.getLong() == 1); 78 } 79 80 public void testSetFloat() throws Exception 81 { 82 objectUnderTest_.setFloat(2f); 83 assertTrue(objectUnderTest_.getFloat() == 2f); 84 } 85 86 public void testSetBoolean() throws Exception 87 { 88 objectUnderTest_ = EvaluationResult.BOOL_TRUE; 89 assertTrue(objectUnderTest_.getLong() == 1); 90 assertTrue(objectUnderTest_.getFloat() == 1f); 91 assertTrue(objectUnderTest_.getBool()); 92 93 objectUnderTest_ = EvaluationResult.BOOL_FALSE; 94 assertTrue(objectUnderTest_.getLong() == 0); 95 assertTrue(objectUnderTest_.getFloat() == 0f); 96 assertTrue(!objectUnderTest_.getBool()); 97 } 98 99 public EvaluationResultTest(String name) 100 { 101 super(name); 102 } 103 104 public static Test suite() 105 { 106 TestSuite suite = new TestSuite(EvaluationResultTest.class); 107 108 return suite; 109 } 110 } | Popular Tags |