Skip to content

Commit

Permalink
update easymock to mockk
Browse files Browse the repository at this point in the history
Signed-off-by: rohan19a <[email protected]>
  • Loading branch information
rohan19a authored Nov 17, 2023
1 parent 2f62130 commit ec6a557
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<CloseableHttpClient>()
val expectedWebhookResponse = DestinationMessageResponse(RestStatus.OK.status, responseContent)

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(responseContent)
EasyMock.replay(mockHttpClient)

val httpClient = DestinationHttpClient(mockHttpClient)
val webhookDestinationTransport = WebhookDestinationTransport(httpClient)
Expand Down

0 comments on commit ec6a557

Please sign in to comment.