FileDocCategorySizeDatePackage
TelnetOptionHandlerTestAbstract.javaAPI DocApache Commons NET 1.4.1 API3296Sat Dec 03 10:05:48 GMT 2005org.apache.commons.net.telnet

TelnetOptionHandlerTestAbstract

public abstract class TelnetOptionHandlerTestAbstract extends TestCase
The TelnetOptionHandlerTest is the abstract class for testing TelnetOptionHandler. It can be used to derive the actual test classes for TelnetOptionHadler derived classes, by adding creation of three new option handlers and testing of the specific subnegotiation behaviour.

author
Bruno D'Avanzo

Fields Summary
TelnetOptionHandler
opthand1
TelnetOptionHandler
opthand2
TelnetOptionHandler
opthand3
Constructors Summary
Methods Summary
protected abstract voidsetUp()
setUp for the test. The derived test class must implement this method by creating opthand1, opthand2, opthand3 like in the following: opthand1 = new EchoOptionHandler(); opthand2 = new EchoOptionHandler(true, true, true, true); opthand3 = new EchoOptionHandler(false, false, false, false);

public abstract voidtestAnswerSubnegotiation()
test of server-driven subnegotiation. Abstract test: the derived class should implement it.

public voidtestConstructors()
test of the constructors. The derived class may add test of the option code.

        // add test of the option code
        assertTrue(!opthand1.getInitLocal());
        assertTrue(!opthand1.getInitRemote());
        assertTrue(!opthand1.getAcceptLocal());
        assertTrue(!opthand1.getAcceptRemote());

        assertTrue(opthand2.getInitLocal());
        assertTrue(opthand2.getInitRemote());
        assertTrue(opthand2.getAcceptLocal());
        assertTrue(opthand2.getAcceptRemote());

        assertTrue(!opthand3.getInitLocal());
        assertTrue(!opthand3.getInitRemote());
        assertTrue(!opthand3.getAcceptLocal());
        assertTrue(!opthand3.getAcceptRemote());
    
public voidtestDo()
test of setDo/getDo

        opthand2.setDo(true);
        opthand3.setDo(false);

        assertTrue(!opthand1.getDo());
        assertTrue(opthand2.getDo());
        assertTrue(!opthand3.getDo());
    
public abstract voidtestStartSubnegotiation()
test of client-driven subnegotiation. Abstract test: the derived class should implement it.

public voidtestWill()
test of setWill/getWill

        opthand2.setWill(true);
        opthand3.setWill(false);

        assertTrue(!opthand1.getWill());
        assertTrue(opthand2.getWill());
        assertTrue(!opthand3.getWill());