Designing some Junit tests and in one of those tests, a create a Commitment,
then delete, then get it to make sure I get a 404.

On the server side, the following code executes:
public Representation get() {
  ...
  setStatus(Status.CLIENT_ERROR_NOT_FOUND, "There is no record with id " +
commitmentIdAttribute);
  return null;
}

On the client side, I have:
  ...
  Representation representation = commitmentResource.get();
  assertNull(representation);
  assertEquals(404, commitmentClient.getResponse().getStatus().getCode());

But as the .get() method is returning, JUnit generates an Error (not a
Failure) of:
Not Found (404) - Not Found
 at org.restlet.resource.ClientResource.doError(ClientResource.java:582)
 at
org.restlet.engine.resource.ClientInvocationHandler.invoke(ClientInvocationHandler.java:269)
 at $Proxy19.get(Unknown Source)
 at
com.fourspires.api.test.BasicCommitmentTests.testCommitmentLifeCycleJson(BasicCommitmentTests.java:69)

(Line 69 is the .get() mentioned above).

Anyone have any pointers to how to do this correctly?   My google searches
have not been fruitful.  

Thanks!
RB


--
View this message in context: 
http://restlet-discuss.1400322.n2.nabble.com/How-to-generate-catch-a-404-error-correctly-tp7394494p7394494.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2938513

Reply via email to