org.eigenbase.util
Class ReflectVisitorTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.eigenbase.util.ReflectVisitorTest
All Implemented Interfaces:
Test

public class ReflectVisitorTest
extends TestCase

ReflectVisitorTest tests ReflectUtil.invokeVisitor(org.eigenbase.util.ReflectiveVisitor, java.lang.Object, java.lang.Class, java.lang.String) and ReflectiveVisitor and provides a contrived example of how to use them.

Version:
$Id: //open/dev/farrago/src/org/eigenbase/util/ReflectVisitorTest.java#15 $
Author:
John V. Sichi

Nested Class Summary
 class ReflectVisitorTest.AmbiguousNumber
          A class inheriting two interfaces, leading to ambiguity.
 class ReflectVisitorTest.CarefulNumberNegater
          CarefulNumberNegater implements NumberNegater in a careful fashion by providing overloads for each known subclass of Number and returning the same subclass for the result.
 class ReflectVisitorTest.CarelessNumberNegater
          CarelessNumberNegater implements NumberNegater in a careless fashion by converting its input to a double and then negating that.
 class ReflectVisitorTest.CluelessNumberNegater
          CluelessNumberNegater implements NumberNegater in a very broken fashion; does the right thing for Shorts, but attempts to override visit(Object).
static interface ReflectVisitorTest.CrunchableNumber
          An interface for introducing ambiguity into the class hierarchy.
static interface ReflectVisitorTest.DiceyNumber
           
static interface ReflectVisitorTest.FudgeableNumber
          An interface for introducing ambiguity into the class hierarchy.
 class ReflectVisitorTest.IndecisiveNumberNegater
          IndecisiveNumberNegater implements NumberNegater in such a way that it doesn't know what to do when presented with an AmbiguousNumber.
 class ReflectVisitorTest.NumberNegater
          NumberNegater defines the abstract base for a computation object capable of negating an arbitrary number.
 class ReflectVisitorTest.SomewhatAmbiguousNumber
          A class inheriting a root interface (FudgeableNumber) two different ways, which should not lead to ambiguity in some cases.
 class ReflectVisitorTest.SomewhatIndecisiveNumberNegater
          SomewhatIndecisiveNumberNegater implements NumberNegater in such a way that it knows what to do when presented with a SomewhatAmbiguousNumber.
 
Constructor Summary
ReflectVisitorTest(String name)
           
 
Method Summary
 void testAmbiguity()
          Tests for ambiguity detection in method lookup.
 void testCarefulNegater()
          Tests CarefulNumberNegater.
 void testCarelessNegater()
          Tests CarelessNumberNegater.
 void testCluelessNegater()
          Tests CluelessNumberNegater.
 void testNonAmbiguity()
          Tests that ambiguity detection in method lookup does not kick in when a better match is available.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ReflectVisitorTest

public ReflectVisitorTest(String name)
Method Detail

testCarelessNegater

public void testCarelessNegater()
Tests CarelessNumberNegater.


testCarefulNegater

public void testCarefulNegater()
Tests CarefulNumberNegater.


testCluelessNegater

public void testCluelessNegater()
Tests CluelessNumberNegater.


testAmbiguity

public void testAmbiguity()
Tests for ambiguity detection in method lookup.


testNonAmbiguity

public void testNonAmbiguity()
Tests that ambiguity detection in method lookup does not kick in when a better match is available.