Search in sources :

Example 1 with JsonHelper

use of org.folio.inventory.support.JsonHelper in project mod-inventory by folio-org.

the class MarcParserTest method validateJsonFieldArrayContainsEmptyJsonObjectItem.

@Test(expected = InvalidMarcJsonException.class)
public void validateJsonFieldArrayContainsEmptyJsonObjectItem() throws IOException, InvalidMarcJsonException {
    JsonObject jo = new JsonHelper().getJsonFileAsJsonObject("/marc/empty-jsonobject-field.json");
    marcParser.marcJson2FolioJson(jo);
}
Also used : JsonHelper(org.folio.inventory.support.JsonHelper) JsonObject(io.vertx.core.json.JsonObject) Test(org.junit.Test)

Example 2 with JsonHelper

use of org.folio.inventory.support.JsonHelper in project mod-inventory by folio-org.

the class MarcParserTest method validateJsonFieldArrayContainsNonJsonObjectItem.

@Test(expected = InvalidMarcJsonException.class)
public void validateJsonFieldArrayContainsNonJsonObjectItem() throws IOException, InvalidMarcJsonException {
    JsonObject jo = new JsonHelper().getJsonFileAsJsonObject("/marc/non-jsonobject-field.json");
    marcParser.marcJson2FolioJson(jo);
}
Also used : JsonHelper(org.folio.inventory.support.JsonHelper) JsonObject(io.vertx.core.json.JsonObject) Test(org.junit.Test)

Example 3 with JsonHelper

use of org.folio.inventory.support.JsonHelper in project mod-inventory by folio-org.

the class MarcParserTest method validateJsonWithoutFieldsKey.

@Test(expected = InvalidMarcJsonException.class)
public void validateJsonWithoutFieldsKey() throws IOException, InvalidMarcJsonException {
    JsonObject jo = new JsonHelper().getJsonFileAsJsonObject("/marc/has-no-fields.json");
    marcParser.marcJson2FolioJson(jo);
}
Also used : JsonHelper(org.folio.inventory.support.JsonHelper) JsonObject(io.vertx.core.json.JsonObject) Test(org.junit.Test)

Example 4 with JsonHelper

use of org.folio.inventory.support.JsonHelper in project mod-inventory by folio-org.

the class MarcParserTest method validateJsonFieldsKeyContainsNoArray.

@Test(expected = InvalidMarcJsonException.class)
public void validateJsonFieldsKeyContainsNoArray() throws IOException, InvalidMarcJsonException {
    JsonObject jo = new JsonHelper().getJsonFileAsJsonObject("/marc/fields-no-array.json");
    marcParser.marcJson2FolioJson(jo);
}
Also used : JsonHelper(org.folio.inventory.support.JsonHelper) JsonObject(io.vertx.core.json.JsonObject) Test(org.junit.Test)

Example 5 with JsonHelper

use of org.folio.inventory.support.JsonHelper in project mod-inventory by folio-org.

the class MarcParserTest method marcJson2FolioJson.

@Test
public void marcJson2FolioJson() throws IOException, InvalidMarcJsonException {
    JsonHelper jh = new JsonHelper();
    JsonObject expected = jh.getJsonFileAsJsonObject("/marc/test-output_01a.json");
    JsonObject actual = marcParser.marcJson2FolioJson(jh.getJsonFileAsJsonObject("/marc/test-input_01a.json"));
    assertEquals(expected.toString(), actual.toString());
    marcParser.marcJson2FolioJson(jh.getJsonFileAsJsonObject("/marc/test-entry_01.json"));
    marcParser.marcJson2FolioJson(jh.getJsonFileAsJsonObject("/marc/test-entry_02.json"));
    marcParser.marcJson2FolioJson(jh.getJsonFileAsJsonObject("/marc/test-entry_03.json"));
    marcParser.marcJson2FolioJson(jh.getJsonFileAsJsonObject("/marc/test-entry_04.json"));
    marcParser.marcJson2FolioJson(jh.getJsonFileAsJsonObject("/marc/test-entry_05.json"));
    marcParser.marcJson2FolioJson(jh.getJsonFileAsJsonObject("/marc/test-entry_06.json"));
}
Also used : JsonHelper(org.folio.inventory.support.JsonHelper) JsonObject(io.vertx.core.json.JsonObject) Test(org.junit.Test)

Aggregations

JsonObject (io.vertx.core.json.JsonObject)5 JsonHelper (org.folio.inventory.support.JsonHelper)5 Test (org.junit.Test)5