7.13 Using HttpUnit to Perform Complex Assertions

7.13.1 Problem

You want to use HttpUnit to perform complex assertions on the returned result.

7.13.2 Solution

Implement an endXXX(com.meterware.httpunit.WebResponse) method for a given testXXX( ) method.

7.13.3 Discussion

Cactus provides support for two endXXX(WebResponse) signatures. You, as the test writer, need to choose one of the method signatures. Cactus ensures that the correct method is invoked.

// write this method for the standard Cactus response
public void endXXX(org.apache.cactus.WebResponse) {
    // insert simple assertions

// or write this method to use HttpUnit
public void endXXX(com.meterware.httpunit.WebResponse) {
    // insert complex assertions

These methods are executed on the client side JVM after the corresponding server side testXXX( ) method completes without throwing an exception.

7.13.4 See Also

For more information on how to use HttpUnit to perform complex assertions, see Chapter 5.