KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > net > telnet > TelnetOptionTest


1 /*
2  * Copyright 2003-2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.commons.net.telnet;
17
18 import junit.framework.TestCase;
19
20 /***
21  * JUnit test class for TelnetOption
22  * <p>
23  * @author Bruno D'Avanzo
24  ***/

25 public class TelnetOptionTest extends TestCase
26 {
27     /***
28      * main for running the test.
29      ***/

30     public static void main(String JavaDoc args[])
31     {
32         junit.textui.TestRunner.run(TelnetOptionTest.class);
33     }
34
35     /***
36      * test of the isValidOption method.
37      ***/

38     public void testisValidOption()
39     {
40         assertTrue(TelnetOption.isValidOption(0));
41         assertTrue(TelnetOption.isValidOption(91));
42         assertTrue(TelnetOption.isValidOption(255));
43         assertTrue(!TelnetOption.isValidOption(256));
44     }
45
46     /***
47      * test of the getOption method.
48      ***/

49     public void testGetOption()
50     {
51         assertEquals(TelnetOption.getOption(0), "BINARY");
52         assertEquals(TelnetOption.getOption(91), "UNASSIGNED");
53         assertEquals(TelnetOption.getOption(255), "Extended-Options-List");
54     }
55 }
Popular Tags