-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(mockito): convert mockito tests to kotlinmockito
SUITEDEV-28852 Co-authored-by: davidSchuppa <[email protected]> Co-authored-by: LasOri <[email protected]> Co-authored-by: LordAndras <[email protected]>
- Loading branch information
1 parent
65e331b
commit 811afc0
Showing
5 changed files
with
91 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 0 additions & 62 deletions
62
core/src/androidTest/java/com/emarsys/core/response/AbstractResponseHandlerTest.java
This file was deleted.
Oops, something went wrong.
48 changes: 48 additions & 0 deletions
48
core/src/androidTest/java/com/emarsys/core/response/AbstractResponseHandlerTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.emarsys.core.response | ||
|
||
import com.emarsys.testUtil.TimeoutUtils.timeoutRule | ||
import org.junit.Before | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import org.junit.rules.TestRule | ||
import org.mockito.kotlin.* | ||
|
||
class AbstractResponseHandlerTest { | ||
private lateinit var abstractResponseHandler: AbstractResponseHandler | ||
|
||
@Rule | ||
@JvmField | ||
var timeout: TestRule = timeoutRule | ||
|
||
@Before | ||
fun init() { | ||
abstractResponseHandler = mock() | ||
} | ||
|
||
@Test | ||
fun testProcessResponse_shouldCallHandleResponse_whenResponseShouldBeHandled() { | ||
whenever(abstractResponseHandler.shouldHandleResponse(any())).doReturn(true) | ||
|
||
val responseModel = ResponseModel.Builder() | ||
.statusCode(200) | ||
.message("OK") | ||
.requestModel(mock()) | ||
.build() | ||
|
||
abstractResponseHandler.processResponse(responseModel) | ||
verify(abstractResponseHandler).handleResponse(responseModel) | ||
} | ||
|
||
@Test | ||
fun testProcessResponse_shouldNotCallHandleResponse_whenResponseShouldNotBeHandled() { | ||
whenever(abstractResponseHandler.shouldHandleResponse(any())).doReturn(false) | ||
|
||
val responseModel = ResponseModel.Builder() | ||
.statusCode(200) | ||
.message("OK") | ||
.requestModel(mock()) | ||
.build() | ||
abstractResponseHandler.processResponse(responseModel) | ||
verify(abstractResponseHandler, times(0)).handleResponse(responseModel) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 0 additions & 3 deletions
3
core/src/main/java/com/emarsys/core/response/AbstractResponseHandler.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters