Hi guys,

I have implemented a protocol stack with MINA. Now, I have to increase my unit tests coverage. I have stuck at the testing of my ProtocolHandler's methods (sessionCreated,sessionOpened, sessionClosed etc..) Therefore i need a concrete or mock class of Protocol Session for my tests. I noticed the TestSession class in your codebase, but it is private class like as ProtocolSessionImpl. Is there any session factory or a public concrete class of ProtocolSession which I can use for tests? If your answer is no, i will pass to my second alternative, JMock.

I am talking about unit tests of such method.Unless i create a session in unit test scope, i cannot test its functionality. Could you recommend a way for testing such methods?

   public void messageReceived(ProtocolSession session, Object message) {
       if (BaseStackLogger.logger.isDebugEnabled()){
BaseStackLogger.logger.debug("Message is received. Message is:"+message.toString());
       }

// some other actions have been done
//
//
    if(!message instanceof MyMessageType) {
   session.close();
   }
    resetTimer();
   }

Reply via email to