CommandControllerTest.java :  » XML » pocogese » com » philemonworks » pocogese » command » Java Open Source

Java Open Source » XML » pocogese 
pocogese » com » philemonworks » pocogese » command » CommandControllerTest.java
package com.philemonworks.pocogese.command;

import java.io.ByteArrayInputStream;
import junit.framework.TestCase;
import org.apache.log4j.BasicConfigurator;
import com.philemonworks.pocogese.Invocation;

public class CommandControllerTest extends TestCase {

  public void setUp(){ BasicConfigurator.configure(); }
  
  public void testExample(){
    ExampleController ec = new ExampleController();
    MockHttpRequest request = new MockHttpRequest();
    request.setInputStream(new ByteArrayInputStream("<command name='example' />".getBytes()));
    Invocation invocation = new Invocation(request,new MockHttpResponse());
    invocation.tokens = new String[]{"command"};
    ec.doPost(invocation);
  }
  public void testExampleUnknown(){
    ExampleController ec = new ExampleController();
    MockHttpRequest request = new MockHttpRequest();
    request.setInputStream(new ByteArrayInputStream("<command name='unkown' />".getBytes()));
    Invocation invocation = new Invocation(request,new MockHttpResponse());
    invocation.tokens = new String[]{"command"};
    ec.doPost(invocation);
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.