Update of /cvsroot/asterisk-java/asterisk-java/src/test/net/sf/asterisk/fastagi
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1721/src/test/net/sf/asterisk/fastagi
Added Files:
AGIResponseImplTest.java
Log Message:
Added AGIResponseImpl
--- NEW FILE: AGIResponseImplTest.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;
import net.sf.asterisk.fastagi.command.NoopCommand;
import net.sf.asterisk.fastagi.reply.AGIReply;
import org.easymock.MockControl;
import junit.framework.TestCase;
public class AGIResponseImplTest extends TestCase
{
private MockControl agiWriterMC;
private AGIWriter agiWriter;
private MockControl agiReaderMC;
private AGIReader agiReader;
private AGIResponse agiResponse;
protected void setUp() throws Exception
{
super.setUp();
this.agiWriterMC = MockControl.createControl(AGIWriter.class);
this.agiWriter = (AGIWriter) agiWriterMC.getMock();
this.agiReaderMC = MockControl.createControl(AGIReader.class);
this.agiReader = (AGIReader) agiReaderMC.getMock();
this.agiResponse = new AGIResponseImpl(agiWriter, agiReader);
}
public void testSendCommand() throws Exception
{
AGIReply reply;
NoopCommand command;
reply = new AGIReply();
reply.setStatus(AGIReply.SC_SUCCESS);
reply.setResult(0);
command = new NoopCommand();
agiWriter.sendCommand(command);
agiReader.readReply();
agiReaderMC.setReturnValue(reply);
agiWriterMC.replay();
agiReaderMC.replay();
assertEquals(reply, agiResponse.sendCommand(command));
agiWriterMC.verify();
agiReaderMC.verify();
}
}
|