From: Nat P. <nat...@b1...> - 2002-11-21 19:04:22
|
If you use decorators around MockCall (e.g. CallSequence or a CallCount) you have to explcitly verify those objects yourself. Hmm... perhaps the Mock class should test to see if the MockCall is Verifiable and then automatically verify it if it is. What do people think? Cheers, Nat. On Thu, 2002-11-21 at 17:14, Barry Kaplan wrote: > 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 > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Mockobjects-java-dev mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev -- Nat Pryce <nat...@b1...> B13media |