use of org.folio.rest.jaxrs.model.JsonapiError in project mod-kb-ebsco-java by folio-org.
the class EholdingsUsageConsolidationImplTest method shouldReturn422WhenUCCredentialNotExist.
@Test
public void shouldReturn422WhenUCCredentialNotExist() {
clearDataFromTable(vertx, UC_CREDENTIALS_TABLE_NAME);
String resourcePath = String.format(UC_SETTINGS_ENDPOINT, credentialsId);
String postBody = Json.encode(getPostRequest());
JsonapiError error = postWithStatus(resourcePath, postBody, SC_UNPROCESSABLE_ENTITY, JOHN_TOKEN_HEADER).as(JsonapiError.class);
String expectedErrorMessage = "Invalid UC API Credentials";
assertErrorContainsTitle(error, expectedErrorMessage);
}
use of org.folio.rest.jaxrs.model.JsonapiError in project mod-kb-ebsco-java by folio-org.
the class EholdingsUsageConsolidationImplTest method shouldReturn401WhenAuthTokenExpired.
@Test
public void shouldReturn401WhenAuthTokenExpired() {
mockAuthToken();
mockFailed401Verification();
setUpUCCredentials(vertx);
String resourcePath = String.format(UC_SETTINGS_ENDPOINT, credentialsId);
String postBody = Json.encode(getPostRequest());
JsonapiError error = postWithStatus(resourcePath, postBody, SC_UNAUTHORIZED).as(JsonapiError.class);
assertErrorContainsTitle(error, "Invalid token");
}
use of org.folio.rest.jaxrs.model.JsonapiError in project mod-kb-ebsco-java by folio-org.
the class LoadHoldingsStatusImplTest method shouldReturn404WhenNoKbCredentialsFound.
@Test
public void shouldReturn404WhenNoKbCredentialsFound() {
final String url = String.format(HOLDINGS_LOAD_STATUS_BY_ID_URL, UUID.randomUUID().toString());
final JsonapiError error = getWithStatus(url, SC_NOT_FOUND, JOHN_TOKEN_HEADER).as(JsonapiError.class);
assertThat(error.getErrors().get(0).getTitle(), containsString("not exist"));
}
use of org.folio.rest.jaxrs.model.JsonapiError in project mod-kb-ebsco-java by folio-org.
the class EholdingsPackagesTest method shouldReturn422OnPutWhenUnselectNonCustomPackageIsHidden.
@Test
public void shouldReturn422OnPutWhenUnselectNonCustomPackageIsHidden() throws URISyntaxException, IOException {
String putBody = readFile("requests/kb-ebsco/package/put-package-not-selected-non-empty-fields.json");
mockGet(new RegexPattern(PACKAGE_BY_ID_URL), PACKAGE_STUB_FILE);
JsonapiError error = putWithStatus(PACKAGES_PATH, putBody, SC_UNPROCESSABLE_ENTITY, CONTENT_TYPE_HEADER, STUB_TOKEN_HEADER).as(JsonapiError.class);
verify(0, putRequestedFor(PACKAGE_URL_PATTERN));
assertErrorContainsTitle(error, "Invalid visibilityData.isHidden");
}
use of org.folio.rest.jaxrs.model.JsonapiError in project mod-kb-ebsco-java by folio-org.
the class EholdingsPackagesTest method shouldReturn422OnPutWhenCustomPackageUpdateLikeNotCustom.
@Test
public void shouldReturn422OnPutWhenCustomPackageUpdateLikeNotCustom() throws URISyntaxException, IOException {
String putBody = readFile("requests/kb-ebsco/package/put-package-selected.json");
mockGet(new RegexPattern(PACKAGE_BY_ID_URL), CUSTOM_PACKAGE_STUB_FILE);
JsonapiError error = putWithStatus(PACKAGES_PATH, putBody, SC_UNPROCESSABLE_ENTITY, CONTENT_TYPE_HEADER, STUB_TOKEN_HEADER).as(JsonapiError.class);
verify(0, putRequestedFor(PACKAGE_URL_PATTERN));
assertErrorContainsTitle(error, "Package isCustom not matched");
}
Aggregations