1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.commons.net.telnet;
17
18 /***
19 * JUnit test class for SimpleOptionHandler
20 * <p>
21 * @author Bruno D'Avanzo
22 ***/
23 public class SimpleOptionHandlerTest extends TelnetOptionHandlerTestAbstract
24 {
25 /***
26 * main for running the test.
27 ***/
28 public static void main(String args[])
29 {
30 junit.textui.TestRunner.run(SimpleOptionHandlerTest.class);
31 }
32
33 /***
34 * setUp for the test.
35 ***/
36 protected void setUp()
37 {
38 opthand1 = new SimpleOptionHandler(4);
39 opthand2 = new SimpleOptionHandler(8, true, true, true, true);
40 opthand3 = new SimpleOptionHandler(91, false, false, false, false);
41 }
42
43 /***
44 * test of the constructors.
45 ***/
46 public void testConstructors()
47 {
48 assertEquals(opthand1.getOptionCode(), 4);
49 assertEquals(opthand2.getOptionCode(), 8);
50 assertEquals(opthand3.getOptionCode(), 91);
51 super.testConstructors();
52 }
53
54 /***
55 * test of client-driven subnegotiation.
56 * Checks that no subnegotiation is made.
57 ***/
58 public void testStartSubnegotiation()
59 {
60
61 int resp1[] = opthand1.startSubnegotiationLocal();
62 int resp2[] = opthand1.startSubnegotiationRemote();
63
64 assertEquals(resp1, null);
65 assertEquals(resp2, null);
66 }
67
68 /***
69 * test of server-driven subnegotiation.
70 * Checks that no subnegotiation is made.
71 ***/
72 public void testAnswerSubnegotiation()
73 {
74 int subn[] =
75 {
76 TelnetCommand.IAC, TelnetCommand.SB, 4,
77 1, TelnetCommand.IAC, TelnetCommand.SE,
78 };
79
80 int resp1[] = opthand1.answerSubnegotiation(subn, subn.length);
81
82 assertEquals(resp1, null);
83 }
84 }