-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CIRC-2198 Implement the code for the feature UXPROD-5001 #1521
Changes from 12 commits
1183999
5121cf0
faca298
5e6f612
7ab9055
48c3cbe
8257312
2ce03bc
b6c736e
93478ab
5d4a533
7cc7e46
0d74155
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -120,10 +120,13 @@ public Result<RequestAndRelatedRecords> sendNoticeOnRequestCancelled( | |
log.debug("sendNoticeOnRequestCancelled:: parameters records: {}", () -> records); | ||
Request request = records.getRequest(); | ||
|
||
if (request.hasItemId()) { | ||
sendCancellationNoticeForRequestWithItemId(request); | ||
} else { | ||
sendCancellationNoticeForRequestWithoutItemId(request); | ||
// Send the cancellation notice only if the isDcbReRequestCancellation flag is false | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we really need this comment? I think code below speaks for itself There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will remove it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
if (!request.getDcbReRequestCancellationValue()) { | ||
if (request.hasItemId()) { | ||
sendCancellationNoticeForRequestWithItemId(request); | ||
} else { | ||
sendCancellationNoticeForRequestWithoutItemId(request); | ||
} | ||
} | ||
|
||
return succeeded(records); | ||
|
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,36 @@ | ||||||||||
package org.folio.circulation.resources; | ||||||||||
|
||||||||||
import static org.mockito.ArgumentMatchers.any; | ||||||||||
import static org.mockito.Mockito.times; | ||||||||||
|
||||||||||
import org.folio.circulation.domain.Request; | ||||||||||
import org.folio.circulation.domain.RequestAndRelatedRecords; | ||||||||||
import org.folio.circulation.domain.notice.ImmediatePatronNoticeService; | ||||||||||
import org.junit.jupiter.api.Test; | ||||||||||
import org.junit.jupiter.api.extension.ExtendWith; | ||||||||||
import org.mockito.InjectMocks; | ||||||||||
import org.mockito.Mock; | ||||||||||
import org.mockito.Mockito; | ||||||||||
import org.mockito.junit.jupiter.MockitoExtension; | ||||||||||
|
||||||||||
import api.support.builders.RequestBuilder; | ||||||||||
import io.vertx.core.json.JsonObject; | ||||||||||
|
||||||||||
@ExtendWith(MockitoExtension.class) | ||||||||||
class RequestNoticeSenderTest { | ||||||||||
|
||||||||||
@Mock | ||||||||||
private ImmediatePatronNoticeService immediatePatronNoticeService; | ||||||||||
@InjectMocks | ||||||||||
private RequestNoticeSender requestNoticeSender; | ||||||||||
|
||||||||||
@Test | ||||||||||
void shouldNotSendNotificationWhenIsDcbCancellationTrue() { | ||||||||||
JsonObject representation = new RequestBuilder().create(); | ||||||||||
representation.put("isDcbReRequestCancellation", true); | ||||||||||
requestNoticeSender.sendNoticeOnRequestCancelled( | ||||||||||
new RequestAndRelatedRecords(Request.from(representation))); | ||||||||||
Mockito.verify(immediatePatronNoticeService, times(0)).acceptNoticeEvent(any()); | ||||||||||
Mockito.verify(immediatePatronNoticeService, times(0)).sendNotice(any(), any()); | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||||||||||
} | ||||||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.