Skip to content

Commit

Permalink
rename function and related tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pluckyswan committed Nov 22, 2024
1 parent fd5554e commit 0638326
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void savePartnerMetadataForInboundMessage(PartnerMetadata partnerMetadata
}
}

public void saveReportIds(String inboundReportId, String outboundReportId) {
public void saveOutboundReportId(String inboundReportId, String outboundReportId) {
if (outboundReportId == null || inboundReportId == null) {
logger.logWarning(
"Inbound and/or outboundReportId is null so not saving metadata for sent result");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ public void convertAndSend(final Order<?> order, String inboundReportId)

sendMessageHelper.linkMessage(inboundReportId);

sendMessageHelper.saveReportIds(inboundReportId, outboundReportId);
sendMessageHelper.saveOutboundReportId(inboundReportId, outboundReportId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ public void convertAndSend(Result<?> result, String inboundReportId)

sendMessageHelper.linkMessage(inboundReportId);

sendMessageHelper.saveReportIds(inboundReportId, outboundReportId);
sendMessageHelper.saveOutboundReportId(inboundReportId, outboundReportId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,38 +74,38 @@ class SendMessageHelperTest extends Specification {
1 * mockLogger.logError(_, _)
}

def "saveReportIds works"() {
def "saveOutboundReportId works"() {
given:
def outboundReportId = "outboundReportId"
def inboundReportId = "inboundReportId"
mockOrchestrator.updateMetadataForOutboundMessage(inboundReportId, _ as String) >> { throw new PartnerMetadataException("Error") }

when:
SendMessageHelper.getInstance().saveReportIds(inboundReportId, outboundReportId)
SendMessageHelper.getInstance().saveOutboundReportId(inboundReportId, outboundReportId)

then:
1 * mockOrchestrator.updateMetadataForOutboundMessage(_, _)
}

def saveReportIds() {
def saveOutboundReportId() {
given:
def inboundReportId = "inboundReportId"

when:
SendMessageHelper.getInstance().saveReportIds(null, inboundReportId)
SendMessageHelper.getInstance().saveOutboundReportId(null, inboundReportId)

then:
1 * mockLogger.logWarning(_)
}

def "saveReportIds should log error and continues when updateMetadataForOutboundMessage throws error"() {
def "saveOutboundReportId should log error and continues when updateMetadataForOutboundMessage throws error"() {
given:
def outboundReportId = "outboundReportId"
def inboundReportId = "inboundReportId"
mockOrchestrator.updateMetadataForOutboundMessage(inboundReportId, _ as String) >> { throw new PartnerMetadataException("Error") }

when:
SendMessageHelper.getInstance().saveReportIds(inboundReportId, outboundReportId)
SendMessageHelper.getInstance().saveOutboundReportId(inboundReportId, outboundReportId)

then:
1 * mockLogger.logError(_, _)
Expand Down

0 comments on commit 0638326

Please sign in to comment.