1 15 package hivemind.test; 16 17 import org.apache.hivemind.HiveMind; 18 import org.apache.hivemind.Locatable; 19 import org.apache.hivemind.Location; 20 import org.apache.hivemind.impl.LocationImpl; 21 22 28 public class TestHiveMindFindLocation extends FrameworkTestCase 29 { 30 public void testEmpty() 31 { 32 assertNull(HiveMind.findLocation(new Object [] { 33 })); 34 } 35 36 public void testAllNull() 37 { 38 assertNull(HiveMind.findLocation(new Object [] { null, null, null })); 39 } 40 41 public void testOrdering() 42 { 43 Location l1 = new LocationImpl(null); 44 Location l2 = new LocationImpl(null); 45 46 assertSame(l1, HiveMind.findLocation(new Object [] { l1, l2 })); 47 } 48 49 public void testLocatable() 50 { 51 Location l1 = new LocationImpl(null); 52 Locatable l2 = new LocatableFixture(l1); 53 54 assertSame(l1, HiveMind.findLocation(new Object [] { l2 })); 55 } 56 57 public void testNullLocatable() 58 { 59 Location l1 = new LocationImpl(null); 60 Locatable l2 = new LocatableFixture(null); 61 Locatable l3 = new LocatableFixture(l1); 62 63 assertSame(l1, HiveMind.findLocation(new Object [] { l2, l3 })); 64 } 65 66 public void testSkipOther() 67 { 68 Location l1 = new LocationImpl(null); 69 70 assertSame(l1, HiveMind.findLocation(new Object [] { this, "Hello", l1, "Goodbye" })); 71 } 72 73 public void testToLocationStringNull() 74 { 75 assertEquals("unknown location", HiveMind.getLocationString(null)); 76 } 77 78 } 79 | Popular Tags |