From 164ee308f2001b1a8be7eae3d3a7f044c4bbf77c Mon Sep 17 00:00:00 2001 From: Jalander Ramagiri Date: Tue, 21 Nov 2023 17:01:16 +0000 Subject: [PATCH] update unit test InvalidRequestException --- .../spinnaker/echo/controllers/WebhooksControllerSpec.groovy | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/echo-webhooks/src/test/groovy/com/netflix/spinnaker/echo/controllers/WebhooksControllerSpec.groovy b/echo-webhooks/src/test/groovy/com/netflix/spinnaker/echo/controllers/WebhooksControllerSpec.groovy index 38919de6a..68a9804ff 100644 --- a/echo-webhooks/src/test/groovy/com/netflix/spinnaker/echo/controllers/WebhooksControllerSpec.groovy +++ b/echo-webhooks/src/test/groovy/com/netflix/spinnaker/echo/controllers/WebhooksControllerSpec.groovy @@ -31,6 +31,7 @@ import spock.lang.Specification import io.cloudevents.CloudEvent import io.cloudevents.core.builder.CloudEventBuilder import com.fasterxml.jackson.databind.ObjectMapper +import com.netflix.spinnaker.kork.web.exceptions.InvalidRequestException import java.nio.charset.StandardCharsets @@ -890,7 +891,7 @@ class WebhooksControllerSpec extends Specification { } - void "handles RuntimeException with invalid CDEvents Webhook Event"() { + void "handles invalid CDEvents Webhook Event"() { given: WebhooksController controller = new WebhooksController(mapper: EchoObjectMapper.getInstance(), scmWebhookHandler: scmWebhookHandler) controller.propagator = Mock(EventPropagator) @@ -911,7 +912,7 @@ class WebhooksControllerSpec extends Specification { when: def response = controller.forwardEvent("artifactPackaged",cdevent, headers) then: - def exception = thrown(RuntimeException) + def exception = thrown(InvalidRequestException) exception.message == "Invalid CDEvent data posted with the CloudEvent RequestBody - $dataMap" }