From: Barry K. <bk...@in...> - 2002-11-21 17:09:31
|
I have the following test snippet: Mock mockConnection = new Mock(Connection.class); Mock mockSelectStatement = new Mock(PreparedStatement.class); Mock mockUpdateStatement = new Mock(PreparedStatement.class); CallSequence prepareStatementCalls = new CallSequence(); prepareStatementCalls.expectReturn(HighLowIdentityGenerator.SELECT_NEXT_BLOCK_STATEMENT, mockSelectStatement.proxy()); prepareStatementCalls.expectReturn(HighLowIdentityGenerator.UPDATE_NEXT_BLOCK_STATEMENT, mockUpdateStatement.proxy()); mockConnection.expect("prepareStatement", prepareStatementCalls); mockSelectStatement.expectAndReturn("executeQuery", null); mockUpdateStatement.expectVoid("execute"); generator.setIdentity(mockDatabaseContext, object); mockConnection.verify(); // This succeeds, I would expect it fail prepareStatementCalls.verify(); // This fails, as I expect assertEquals(1, object.getId()); It seems that the MethodMap only checks that the method of the name was invoked, but does not take into account that the MockCall for that method was a CallSequence. Should MethodMap be delegating to MockCall for [part of?] its verify? -bk |