From: Czterysta Czwarty on 14 Jun 2010 04:53 Hi everybody! I'm trying to test my Apache MINA filter with JUnit and EasyMock. Can you help me? XMLMappingFilter() should convert XML String to Object. I defined instance of tested class and 3 mocks: @Before public void setUp() throws Exception { instance = new XMLMappingFilter(); nextFilterMock = createMock(NextFilter.class); sessionMock = createMock(IoSession.class); messageMock = createMock(String.class); instance.messageReceived(nextFilterMock, sessionMock, messageMock); } and try to test: @Test public void testMessageReceived() throws Exception { System.out.println("messageReceived"); //2. record mock messageMock.toString(); expectLastCall().andReturn("<message username=\"user(a)domain.com \"><body>WiadomoÅÄ!</body></message>"); expect(sessionMock). //3. replay mocks replay(nextFilterMock); replay(sessionMock); replay(messageMock); //4.tes instance.messageReceived(nextFilterMock, sessionMock, messageMock); //..... } instance.messageReceived() should call nextFilterMock.messageReceived() with changed new parameters. My question is: How to check with what parameters this method is called? In other words: How to verify, did strings are correctly converting to objects?
|
Pages: 1 Prev: Open Source installer toolkits? Next: problem with method overloading |