1 20 package org.apache.mina.common; 21 22 import junit.framework.Assert; 23 import junit.framework.TestCase; 24 25 31 public class TransportTypeTest extends TestCase { 32 33 public static void main(String [] args) { 34 junit.textui.TestRunner.run(TransportTypeTest.class); 35 } 36 37 public void testRegistration() { 38 TransportType myType = new TransportType( 39 new String [] { "a", "b", "c" }, true); 40 41 Assert.assertSame(myType, TransportType.getInstance("a")); 42 Assert.assertSame(myType, TransportType.getInstance("A")); 43 Assert.assertSame(myType, TransportType.getInstance("b")); 44 Assert.assertSame(myType, TransportType.getInstance("B")); 45 Assert.assertSame(myType, TransportType.getInstance("c")); 46 Assert.assertSame(myType, TransportType.getInstance("C")); 47 try { 48 TransportType.getInstance("unknown"); 49 Assert.fail(); 50 } catch (IllegalArgumentException e) { 51 } 53 54 try { 55 new TransportType(new String [] { "A" }, false); 56 Assert.fail(); 57 } catch (IllegalArgumentException e) { 58 } 60 } 61 62 } 63 | Popular Tags |