use of org.folio.rest.support.builders.LoanPolicyRequestBuilder in project mod-circulation-storage by folio-org.
the class LoanPoliciesApiTest method cannotUseHoldAlternateRenewalLoanPeriodForFixedProfile.
@Test
public void cannotUseHoldAlternateRenewalLoanPeriodForFixedProfile() throws Exception {
DateTime from = DateTime.now().minusMonths(3);
DateTime to = DateTime.now().plusMonths(3);
DateTime dueDate = to.plusDays(15);
IndividualResource fixedDueDateSchedule = createFixedDueDateSchedule("semester_for_fixed_policy", from, to, dueDate);
LoanPolicyRequestBuilder loanPolicy = emptyPolicy().fixed(fixedDueDateSchedule.getId()).withAlternateFixedDueDateScheduleId(fixedDueDateSchedule.getId()).withHoldsRenewalLoanPeriod(new Period().withDuration(1).withIntervalId(Period.IntervalId.DAYS));
CompletableFuture<JsonResponse> createCompleted = new CompletableFuture<>();
client.post(loanPolicyStorageUrl(), loanPolicy.create(), StorageTestSuite.TENANT_ID, ResponseHandler.json(createCompleted));
JsonResponse postResponse = createCompleted.get(5, TimeUnit.SECONDS);
assertThat(postResponse.getStatusCode(), is(422));
assertThat(postResponse.getJson().getJsonArray("errors").getJsonObject(0).getString("message"), is("Alternate Renewal Loan Period for Holds is not allowed for policies with Fixed profile"));
}
use of org.folio.rest.support.builders.LoanPolicyRequestBuilder in project mod-circulation-storage by folio-org.
the class LoanPoliciesApiTest method cannotUseRenewalsPeriodForFixedProfile.
@Test
public void cannotUseRenewalsPeriodForFixedProfile() throws Exception {
DateTime from = DateTime.now().minusMonths(3);
DateTime to = DateTime.now().plusMonths(3);
DateTime dueDate = to.plusDays(15);
IndividualResource fixedDueDateSchedule = createFixedDueDateSchedule("semester fixed policy test", from, to, dueDate);
LoanPolicyRequestBuilder loanPolicy = emptyPolicy().fixed(fixedDueDateSchedule.getId()).withAlternateFixedDueDateScheduleId(fixedDueDateSchedule.getId()).withName("test").withRenewalPeriod(new Period().withDuration(1).withIntervalId(Period.IntervalId.DAYS));
CompletableFuture<JsonResponse> createCompleted = new CompletableFuture<>();
client.post(loanPolicyStorageUrl(), loanPolicy.create(), StorageTestSuite.TENANT_ID, ResponseHandler.json(createCompleted));
JsonResponse postResponse = createCompleted.get(5, TimeUnit.SECONDS);
assertThat(postResponse.getStatusCode(), is(422));
assertThat(postResponse.getJson().getJsonArray("errors").getJsonObject(0).getString("message"), is("Period in RenewalsPolicy is not allowed for policies with Fixed profile"));
}
Aggregations