From ec6a557c6e2012e3a3cc4506971dfd17ae189207 Mon Sep 17 00:00:00 2001 From: rohan19a <46227014+rohan19a@users.noreply.github.com> Date: Thu, 16 Nov 2023 18:50:33 -0800 Subject: [PATCH] update easymock to mockk Signed-off-by: rohan19a <46227014+rohan19a@users.noreply.github.com> --- .../core/destinations/ChimeDestinationTests.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 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 ced920e1..1a036ad5 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 @@ -12,7 +12,6 @@ import org.apache.hc.client5.http.classic.methods.HttpPost import org.apache.hc.client5.http.impl.classic.CloseableHttpClient import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse import org.apache.hc.core5.http.io.entity.StringEntity -import org.easymock.EasyMock import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.BeforeEach @@ -117,14 +116,13 @@ internal class ChimeDestinationTests { @Test fun `test chime message non-empty entity response`() { val responseContent = "It worked!" - val mockHttpClient: CloseableHttpClient = EasyMock.createMock(CloseableHttpClient::class.java) + val mockHttpClient = mockk() val expectedWebhookResponse = DestinationMessageResponse(RestStatus.OK.status, responseContent) 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(responseContent) - EasyMock.replay(mockHttpClient) val httpClient = DestinationHttpClient(mockHttpClient) val webhookDestinationTransport = WebhookDestinationTransport(httpClient)