1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.mina.common;
21
22 import junit.framework.Assert;
23 import junit.framework.TestCase;
24
25
26
27
28
29
30
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
52 }
53
54 try {
55 new TransportType(new String[] { "A" }, false);
56 Assert.fail();
57 } catch (IllegalArgumentException e) {
58
59 }
60 }
61
62 }