cvs commit: spice/components/netserve/src/test/org/jcomponent/netserve/connection/handlers DelegatingRequestHandlerTestCase.java

Peter Donald <[email protected]>
Newsgroups gmane.comp.java.spice.cvs
Message-ID <[email protected]>
donaldp     03/10/27 22:29:11

  Added:       components/netserve/src/test/org/jcomponent/netserve/connection/handlers
                        DelegatingRequestHandlerTestCase.java
  Log:
  Start handling delegating request handlers
  
  Revision  Changes    Path
  1.1                  spice/components/netserve/src/test/org/jcomponent/netserve/connection/handlers/DelegatingRequestHandlerTestCase.java
  
  Index: DelegatingRequestHandlerTestCase.java
  ===================================================================
  package org.jcomponent.netserve.connection.handlers;
  
  import java.net.Socket;
  
  import com.mockobjects.dynamic.C;
  import com.mockobjects.dynamic.Mock;
  import junit.framework.TestCase;
  import org.jcomponent.netserve.connection.RequestHandler;
  
  public class DelegatingRequestHandlerTestCase
     extends TestCase
  {
     public void testNullPassedIntoCtor()
        throws Exception
     {
        try
        {
           new DelegatingRequestHandler( null );
        }
        catch ( final NullPointerException npe )
        {
           assertEquals( "npe.getMessage()", "handler", npe.getMessage() );
           return;
        }
     }
  
     public void testDelegateHandlerInvoked()
        throws Exception
     {
        final Mock mockHandler = new Mock( RequestHandler.class );
        final Socket socket = new Socket();
        final Long timeout = new Long( 23 );
        mockHandler.expect( "handleConnection", C.args( C.eq( socket ) ) );
        mockHandler.expect( "shutdown", C.args( C.eq( timeout ) ) );
        final RequestHandler handler = (RequestHandler) mockHandler.proxy();
        final DelegatingRequestHandler delegatingHandler =
           new DelegatingRequestHandler( handler );
  
        delegatingHandler.handleConnection( socket );
        delegatingHandler.shutdown( 23 );
     }
  }
  
  
  


-------------------------------------------------------
This SF.net email is sponsored by: The SF.net Donation Program.
Do you like what SourceForge.net is doing for the Open
Source Community?  Make a contribution, and help us add new
features and functionality. Click here: http://sourceforge.net/donate/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.