Skip to content

Commit

Permalink
update unit test InvalidRequestException
Browse files Browse the repository at this point in the history
  • Loading branch information
Jalander Ramagiri committed Nov 21, 2023
1 parent 82ab978 commit 164ee30
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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"

}
Expand Down

0 comments on commit 164ee30

Please sign in to comment.