1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.mina.integration.beans;
21
22 import junit.framework.TestCase;
23
24 import org.apache.mina.transport.vmpipe.VmPipeAddress;
25
26
27
28
29
30
31
32 public class VmPipeAddressEditorTest extends TestCase {
33 VmPipeAddressEditor editor;
34
35 @Override
36 protected void setUp() throws Exception {
37 editor = new VmPipeAddressEditor();
38 }
39
40 public void testSetAsTextWithLegalValues() throws Exception {
41 editor.setAsText("1");
42 assertEquals(new VmPipeAddress(1), editor.getValue());
43 editor.setAsText(":10");
44 assertEquals(new VmPipeAddress(10), editor.getValue());
45 editor.setAsText(":100");
46 assertEquals(new VmPipeAddress(100), editor.getValue());
47 }
48
49 public void testSetAsTextWithIllegalValues() throws Exception {
50 try {
51 editor.setAsText("bar");
52 fail("Illegal port number. IllegalArgumentException expected.");
53 } catch (IllegalArgumentException iae) {
54 }
55 try {
56 editor.setAsText(":foo");
57 fail("Illegal port number. IllegalArgumentException expected.");
58 } catch (IllegalArgumentException iae) {
59 }
60 }
61
62 }