Forum Discussion
Poobury
11 years agoNew Contributor
Just to update, I managed to get a reflection solution working in case it helps anyone else:
Cheers,
Paul.
// Add a response code assertion.
assertion = newTestStep.addAssertion(ValidHttpStatusCodesAssertion.LABEL);
// XXX there isn't a setter for the "codes" fields, so we need to set it via reflection.
java.lang.reflect.Field statusAssertionCodesField = assertion.getClass().getDeclaredField("codes");
// Make the private field accessible
statusAssertionCodesField.setAccessible(true);
statusAssertionCodesField.set(assertion, "200,404")
Cheers,
Paul.
Related Content
- 2 years agodkhanForce
- 8 years agocheriewoo
- 11 years agoavitaurus19