The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

davidxl (1) [Avatar] Offline

I ran the jMock tests for Chapter 3 , and all of them failed for me.

I'm using RAD 7, Java 5, and jMock 1.2.

When I tested as a JUnit, I got java.lang.IllegalArgumentException: net.chrisrichardson.foodToGo.domain.PendingOrder is not an interface. That was from the line:

mockPendingOrder = new Mock(PendingOrder.class);

Could anyone tell me what I should do to be able to run the tests?

Many thanks,
SomeGuy (1) [Avatar] Offline
Re: jMock fails
You need to import org.jmock.cglib.MockObjectTestCase instead of the MockObjectTestCase from something like org.jmock.MockObjectTestCase if you want to mock a class rather than an interface. Note that this is for jmock 1.x only.
simbo1905 (30) [Avatar] Offline
Re: jMock fails
RAD is based on Eclipse but sometime (mostly!) makes things harder when not working directly with websphere. Although some companies force the use of a given IDE in order to see things working it is a good idea to run things on a vanilla eclipse running maven which lets you see library versions are being used to help you debug things in a corporate IDE. Here is a link to a post which shows the steps to get things running in eclipse: