Skip to content

Commit

Permalink
UXPROD-5001 UT, description
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonAntonich committed Dec 13, 2024
1 parent cda183c commit dbab947
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ramls/request.json
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@
"type": "string"
},
"isDcbReRequestCancellation": {
"description": "Indicates whether the request was cancelled during a DCB transaction update",
"description": "Indicates if the request was cancelled during a DCB transaction update. This determines whether the Kafka event will be handled and if an email notification will be sent",
"type": "boolean"
}
},
Expand Down
27 changes: 27 additions & 0 deletions src/test/java/org/folio/rest/api/RequestUpdateTriggerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@
import io.vertx.core.json.JsonObject;
import io.vertx.sqlclient.Row;
import io.vertx.sqlclient.RowSet;
import lombok.SneakyThrows;

import org.joda.time.DateTime;
import org.joda.time.Seconds;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;

Expand Down Expand Up @@ -55,6 +57,31 @@ void beforeEach() throws MalformedURLException {
StorageTestSuite.deleteAll(requestStorageUrl());
}

@Test
@SneakyThrows
public void isDcbReRequestCancellationShouldBePresentAfterRequestUpdated() {
CompletableFuture<JsonObject> future = new CompletableFuture<>();

String id = "3a57dc83-e70d-404b-b1f1-442b88760331";
Request request = new Request()
.withStatus(fromValue(Request.Status.OPEN_NOT_YET_FILLED.toString()));

assertThat(request.getIsDcbReRequestCancellation(), is(nullValue()));

saveRequest(id, request)
.compose(v -> updateRequest(id, request
.withStatus(fromValue(Request.Status.CLOSED_CANCELLED.toString()))
.withIsDcbReRequestCancellation(Boolean.TRUE)))
.compose(v -> getRequest(id))
.onComplete(updatedRequest -> future.complete(updatedRequest.result()));

JsonObject updatedRequest = future.get(5, TimeUnit.SECONDS);

assertThat(updatedRequest.getString("isDcbReRequestCancellation"),
is(notNullValue()));

}

@ParameterizedTest
@CsvSource(value = {
"Open - Awaiting pickup | Closed - Pickup expired",
Expand Down

0 comments on commit dbab947

Please sign in to comment.