private void doRegisterDocumentAndCheckError( SubmitObjectsRequest req, String errorCode, String prefix) { RegistryResponseType rsp = null; try { rsp = session.documentRegistryRegisterDocumentSetB(req); } catch (Exception x) { fail(prefix + ": Register document failed unexpected! Error:" + x); } if (!XDSConstants.XDS_B_STATUS_FAILURE.equals(rsp.getStatus())) { fail(prefix + ": Register document should fail with error code:" + errorCode); } String error = rsp.getRegistryErrorList().getRegistryError().get(0).getErrorCode(); assertEquals(prefix + ": Error code:", errorCode, error); }