Skip to content

Commit

Permalink
update easyMock to mock
Browse files Browse the repository at this point in the history
Signed-off-by: rohan19a <[email protected]>
  • Loading branch information
rohan19a authored Nov 15, 2023
1 parent 62b7b4f commit 176528e
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,23 +87,22 @@ internal class ChimeDestinationTests {

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

val httpResponse = mockk<CloseableHttpResponse>()
EasyMock.expect(mockHttpClient.execute(EasyMock.anyObject(HttpPost::class.java))).andReturn(httpResponse)
every { mockHttpClient.execute(any<HttpPost>()) } 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)
DestinationTransportProvider.destinationTransportMap = mapOf(DestinationType.CHIME to webhookDestinationTransport)

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

val destination = ChimeDestination(url)
Expand Down

0 comments on commit 176528e

Please sign in to comment.