[java-dev] Re: Re: Unit testing Java externals that call outlet()
Adam Murray
adamjmurray at gmail.com
Sun Aug 12 16:47:18 MDT 2007
- Previous message: [java-dev] Re: Unit testing Java externals that call outlet()
- Next message: [java-dev] Re: Re: Unit testing Java externals that call outlet()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Quote: nick rothwell / cassiel wrote on Sun, 12 August 2007 02:24 ---------------------------------------------------- > > [Have] you looked at JMock? > > I just spent some time with JMock and can't get it to do what I need. Since the objects I am dealing with are not interfaces, I was looking at this: http://www.jmock.org/mocking-classes.html. But when I use a ClassImposteriser, it seems like any calls I make to the mock object don't actually do anything. I believe it replaced my class with a empty stub class that does nothing. I need this to happen on the superclass, not my class. Maybe I just don't understand JMock yet but I do not think it is a good solution for me. Here is all I want to do: 1. Instantiate my mxj external 2. Call some methods on my external that transform it's internal state (these simulate incoming max messages) 3. Use a getter to access the internal state on my external and compare that against an expected value. In order to accomplish this, I have to prevent MaxObject from doing what it normally does in the runtime environment. Besides the JNI calls, I am also running into an issue where I want to call System.out.println() for debugging and I can't because it is tied to some output stream for the runtime that does not exist when unit testing. I don't see how JMock would let me easily swap in a fake MaxObject implementation, and even if it did, I don't need or want to deal with JMocks system of expectations. jUnit's asserts() already do everything I need. Adam
- Previous message: [java-dev] Re: Unit testing Java externals that call outlet()
- Next message: [java-dev] Re: Re: Unit testing Java externals that call outlet()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
