Skip to content

Commit 176528e

Browse files
authored
update easyMock to mock
Signed-off-by: rohan19a <[email protected]>
1 parent 62b7b4f commit 176528e

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

notifications/core/src/test/kotlin/org/opensearch/notifications/core/destinations/ChimeDestinationTests.kt

+4-5
Original file line numberDiff line numberDiff line change
@@ -87,23 +87,22 @@ internal class ChimeDestinationTests {
8787

8888
@Test
8989
fun `test chime message empty entity response`() {
90-
val mockHttpClient: CloseableHttpClient = EasyMock.createMock(CloseableHttpClient::class.java)
90+
val mockHttpClient = mockk<CloseableHttpClient>()
9191
val expectedWebhookResponse = DestinationMessageResponse(RestStatus.OK.status, "{}")
9292

9393
val httpResponse = mockk<CloseableHttpResponse>()
94-
EasyMock.expect(mockHttpClient.execute(EasyMock.anyObject(HttpPost::class.java))).andReturn(httpResponse)
94+
every { mockHttpClient.execute(any<HttpPost>()) } returns httpResponse
9595
every { httpResponse.code } returns RestStatus.OK.status
9696
every { httpResponse.entity } returns StringEntity("")
97-
EasyMock.replay(mockHttpClient)
9897

9998
val httpClient = DestinationHttpClient(mockHttpClient)
10099
val webhookDestinationTransport = WebhookDestinationTransport(httpClient)
101100
DestinationTransportProvider.destinationTransportMap = mapOf(DestinationType.CHIME to webhookDestinationTransport)
102101

103102
val title = "test Chime"
104103
val messageText = "{\"Content\":\"Message gughjhjlkh Body emoji test: :) :+1: " +
105-
"link test: http://sample.com email test: [email protected] All member call out: " +
106-
"@All All Present member call out: @Present\"}"
104+
"link test: http://sample.com email test: [email protected] All member call out: " +
105+
"@All All Present member call out: @Present\"}"
107106
val url = "https://abc/com"
108107

109108
val destination = ChimeDestination(url)

0 commit comments

Comments
 (0)