From 176528ec27e4ca48fda73d5c75f8ad097faca33e Mon Sep 17 00:00:00 2001 From: rohan19a <46227014+rohan19a@users.noreply.github.com> Date: Wed, 15 Nov 2023 12:55:34 -0800 Subject: [PATCH] update easyMock to mock Signed-off-by: rohan19a <46227014+rohan19a@users.noreply.github.com> --- .../core/destinations/ChimeDestinationTests.kt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/notifications/core/src/test/kotlin/org/opensearch/notifications/core/destinations/ChimeDestinationTests.kt b/notifications/core/src/test/kotlin/org/opensearch/notifications/core/destinations/ChimeDestinationTests.kt index aebcde92..eda3abf3 100644 --- a/notifications/core/src/test/kotlin/org/opensearch/notifications/core/destinations/ChimeDestinationTests.kt +++ b/notifications/core/src/test/kotlin/org/opensearch/notifications/core/destinations/ChimeDestinationTests.kt @@ -87,14 +87,13 @@ internal class ChimeDestinationTests { @Test fun `test chime message empty entity response`() { - val mockHttpClient: CloseableHttpClient = EasyMock.createMock(CloseableHttpClient::class.java) + val mockHttpClient = mockk() val expectedWebhookResponse = DestinationMessageResponse(RestStatus.OK.status, "{}") val httpResponse = mockk() - EasyMock.expect(mockHttpClient.execute(EasyMock.anyObject(HttpPost::class.java))).andReturn(httpResponse) + every { mockHttpClient.execute(any()) } returns httpResponse every { httpResponse.code } returns RestStatus.OK.status every { httpResponse.entity } returns StringEntity("") - EasyMock.replay(mockHttpClient) val httpClient = DestinationHttpClient(mockHttpClient) val webhookDestinationTransport = WebhookDestinationTransport(httpClient) @@ -102,8 +101,8 @@ internal class ChimeDestinationTests { val title = "test Chime" val messageText = "{\"Content\":\"Message gughjhjlkh Body emoji test: :) :+1: " + - "link test: http://sample.com email test: marymajor@example.com All member call out: " + - "@All All Present member call out: @Present\"}" + "link test: http://sample.com email test: marymajor@example.com All member call out: " + + "@All All Present member call out: @Present\"}" val url = "https://abc/com" val destination = ChimeDestination(url)