1 15 package org.apache.hivemind.schema.rules; 16 17 import org.apache.hivemind.internal.Module; 18 import org.apache.hivemind.schema.Translator; 19 import org.apache.hivemind.test.HiveMindTestCase; 20 import org.easymock.MockControl; 21 22 28 public class TestIdTranslators extends HiveMindTestCase 29 { 30 public void testNullId() 31 { 32 Translator t = new QualifiedIdTranslator(); 33 34 assertNull(t.translate(null, null, null, null)); 35 } 36 37 private Module getModule() 38 { 39 MockControl c = newControl(Module.class); 40 Module result = (Module) c.getMock(); 41 42 result.getModuleId(); 43 c.setReturnValue("foo.bar"); 44 45 return result; 46 } 47 48 public void testNonNullId() 49 { 50 Module m = getModule(); 51 52 replayControls(); 53 54 Translator t = new QualifiedIdTranslator(); 55 56 assertEquals("foo.bar.Baz", t.translate(m, null, "Baz", null)); 57 58 verifyControls(); 59 } 60 61 public void testNullList() 62 { 63 Translator t = new IdListTranslator(); 64 65 assertEquals(null, t.translate(null, null, null, null)); 66 } 67 68 public void testNonNullList() 69 { 70 Module m = getModule(); 71 72 replayControls(); 73 74 Translator t = new IdListTranslator(); 75 76 assertEquals("foo.bar.Baz,zip.Zap", t.translate(m, null, "Baz,zip.Zap", null)); 77 78 verifyControls(); 79 } 80 } 81 | Popular Tags |