Skip to content

Commit

Permalink
CIRCSTORE-519 merge to master PR
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonAntonich committed Aug 19, 2024
1 parent a429346 commit 5305d9b
Showing 1 changed file with 23 additions and 20 deletions.
43 changes: 23 additions & 20 deletions src/test/java/org/folio/rest/api/CirculationSettingsAPITest.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public class CirculationSettingsAPITest extends ApiTests {
private static final String TABLE_NAME = "circulation_settings";
private static final String CIRCULATION_SETTINGS_PROPERTY = "circulation-settings";
private static final int NOT_FOUND_STATUS = 404;
private static final String REQUEST_PRINT_SETTING = "Enable Request Print";

private final AssertingRecordClient circulationSettingsClient =
new AssertingRecordClient(
Expand Down Expand Up @@ -91,6 +92,28 @@ public void canDeleteCirculationSettings() {
assertThat(deletedCirculationSettings.getStatusCode(), is(NOT_FOUND_STATUS));
}

@Test
@SneakyThrows
public void canCreateAndRetrieveEnableRequestPrintDetailsSetting() {
String id = UUID.randomUUID().toString();
JsonObject enableRequestPrintDetailsSettingJson = new JsonObject();
enableRequestPrintDetailsSettingJson.put(ID_KEY, id);
enableRequestPrintDetailsSettingJson.put(NAME_KEY, REQUEST_PRINT_SETTING);
JsonObject enablePrintSettingJson = new JsonObject().put(REQUEST_PRINT_SETTING, true);
enableRequestPrintDetailsSettingJson.put(VALUE_KEY, enablePrintSettingJson);

JsonObject circulationSettingsResponse =
circulationSettingsClient.create(enableRequestPrintDetailsSettingJson).getJson();
JsonObject circulationSettingsById = circulationSettingsClient.getById(id).getJson();

assertThat(circulationSettingsResponse.getString(ID_KEY), is(id));
assertThat(circulationSettingsResponse.getString(NAME_KEY),
is(enableRequestPrintDetailsSettingJson.getString(NAME_KEY)));
assertThat(circulationSettingsById.getString(ID_KEY), is(id));
assertThat(circulationSettingsById.getJsonObject(VALUE_KEY),
is(enableRequestPrintDetailsSettingJson.getJsonObject(VALUE_KEY)));
}

private static String getValue(JsonObject circulationSettingsById) {
return circulationSettingsById.getJsonObject(VALUE_KEY).getString(SAMPLE_KEY);
}
Expand Down Expand Up @@ -121,24 +144,4 @@ private JsonObject getUpdatedSettingsJson() {
circulationSettingsJsonUpdated.put(VALUE_KEY, updatedValue);
return circulationSettingsJsonUpdated;
}
@Test
public void canCreateAndRetrieveEnableRequestPrintDetailsSetting() throws MalformedURLException,
ExecutionException, InterruptedException, TimeoutException {
String id = UUID.randomUUID().toString();
JsonObject enableRequestPrintDetailsSettingJson = new JsonObject();
enableRequestPrintDetailsSettingJson.put("id", id);
enableRequestPrintDetailsSettingJson.put("name", "Enable Request Print");
enableRequestPrintDetailsSettingJson.put("value", new JsonObject().put("Enable Request Print", true));

JsonObject circulationSettingsResponse =
circulationSettingsClient.create(enableRequestPrintDetailsSettingJson).getJson();
JsonObject circulationSettingsById = circulationSettingsClient.getById(id).getJson();

assertThat(circulationSettingsResponse.getString("id"), is(id));
assertThat(circulationSettingsResponse.getString("name"),
is(enableRequestPrintDetailsSettingJson.getString("name")));
assertThat(circulationSettingsById.getString("id"), is(id));
assertThat(circulationSettingsById.getJsonObject("value"),
is(enableRequestPrintDetailsSettingJson.getJsonObject("value")));
}
}

0 comments on commit 5305d9b

Please sign in to comment.