assertNotNull(respObject);
final PKIBody body = respObject.getBody();
final int tag = body.getTagNo();
assertEquals(exptag, tag);
final PKIStatusInfo info;
if (exptag == CmpPKIBodyConstants.ERRORMESSAGE) {
ErrorMsgContent c = body.getError();
assertNotNull(c);
info = c.getPKIStatus();
assertNotNull(info);
assertEquals(ResponseStatus.FAILURE.getIntValue(), info.getStatus().getValue().intValue());
int i = info.getFailInfo().intValue();
assertEquals(i, 1 << err);
} else if (exptag == CmpPKIBodyConstants.REVOCATIONRESPONSE) {
RevRepContent rrc = body.getRp();
assertNotNull(rrc);
info = rrc.getPKIStatusInfo(0);
assertNotNull(info);
assertEquals(ResponseStatus.FAILURE.getIntValue(), info.getStatus().getValue().intValue());
assertEquals(FailInfo.BAD_REQUEST.getAsBitString(), info.getFailInfo());
} else {
CertRepMessage c = null;
if (exptag == CmpPKIBodyConstants.INITIALIZATIONRESPONSE) {
c = body.getIp();
} else if (exptag == CmpPKIBodyConstants.CERTIFICATIONRESPONSE) {
c = body.getCp();
}
assertNotNull(c);
CertResponse resp = c.getResponse(0);
assertNotNull(resp);
assertEquals(resp.getCertReqId().getValue().intValue(), requestId);
info = resp.getStatus();
assertNotNull(info);
int error = info.getStatus().getValue().intValue();
assertEquals(ResponseStatus.FAILURE.getIntValue(), error); // 2 is
// rejection
assertEquals(FailInfo.INCORRECT_DATA.getAsBitString(), info.getFailInfo());
}
log.debug("expected fail message: '" + failMsg + "'. received fail message: '" + info.getStatusString().getString(0).getString() + "'.");
assertEquals(failMsg, info.getStatusString().getString(0).getString());
}