Update of /cvsroot/asterisk-java/asterisk-java/src/test/net/sf/asterisk/fastagi/command
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2495/src/test/net/sf/asterisk/fastagi/command
Added Files:
GetDataCommandTest.java
Log Message:
Changed GetDataCommand to include timeout and maxDigits only if needed.
--- NEW FILE: GetDataCommandTest.java ---
/*
* Copyright 2004-2005 Stefan Reuter
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package net.sf.asterisk.fastagi.command;
import junit.framework.TestCase;
public class GetDataCommandTest extends TestCase
{
private GetDataCommand getDataCommand;
public void testDefault()
{
getDataCommand = new GetDataCommand("VAR1");
assertEquals("GET DATA \"VAR1\"", getDataCommand.buildCommand());
}
public void testSetTimeout()
{
getDataCommand = new GetDataCommand("VAR1");
getDataCommand.setTimeout(10000);
assertEquals(10000, getDataCommand.getTimeout());
assertEquals(1024, getDataCommand.getMaxDigits());
assertEquals("GET DATA \"VAR1\" 10000", getDataCommand.buildCommand());
}
public void testSetMaxDigits()
{
getDataCommand = new GetDataCommand("VAR1");
getDataCommand.setMaxDigits(10);
assertEquals(0, getDataCommand.getTimeout());
assertEquals(10, getDataCommand.getMaxDigits());
assertEquals("GET DATA \"VAR1\" 0 10", getDataCommand.buildCommand());
}
public void testSetTimeoutAndMaxDigits()
{
getDataCommand = new GetDataCommand("VAR1");
getDataCommand.setTimeout(10000);
getDataCommand.setMaxDigits(20);
assertEquals(10000, getDataCommand.getTimeout());
assertEquals(20, getDataCommand.getMaxDigits());
assertEquals("GET DATA \"VAR1\" 10000 20", getDataCommand.buildCommand());
}
}
|