Skip to content

Commit 4830349

Browse files
authored
Reorder simple response factory fields (#407)
* Reordered SimpleResponseFactory fields to align with MockResponse. * Made bodyFileName nullable.
1 parent 1bcda18 commit 4830349

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

app/src/androidTest/java/com/mitteloupe/whoami/server/AppResponseStore.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@ class AppResponseStore : ResponseStore() {
1616
override val internalResponseFactories = listOf(
1717
REQUEST_RESPONSE_GET_IP to MockRequestResponseFactory(
1818
request = MockRequest(IPIFY_ENDPOINT),
19-
responseFactory = SimpleResponseFactory(200, "api/get_ip.json")
19+
responseFactory = SimpleResponseFactory(code = 200, bodyFileName = "api/get_ip.json")
2020
),
2121
REQUEST_RESPONSE_GET_IP_DETAILS to MockRequestResponseFactory(
2222
request = MockRequest("${IPINFO_ENDPOINT}$IP_ADDRESS/geo"),
23-
responseFactory = SimpleResponseFactory(200, "api/get_ip_details.json")
23+
responseFactory = SimpleResponseFactory(
24+
code = 200,
25+
bodyFileName = "api/get_ip_details.json"
26+
)
2427
)
2528
)
2629
}

architecture/instrumentation-test/src/main/java/com/mitteloupe/whoami/test/server/response/SimpleResponseFactory.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import com.mitteloupe.whoami.test.server.MockResponse
55

66
data class SimpleResponseFactory(
77
private val code: Int = 200,
8-
private val bodyFileName: String = "",
9-
private val headers: List<Pair<String, String>> = emptyList()
8+
private val headers: List<Pair<String, String>> = emptyList(),
9+
private val bodyFileName: String? = null
1010
) : MockResponseFactory {
1111
private val body by lazy {
12-
if (bodyFileName.isEmpty()) {
12+
if (bodyFileName == null) {
1313
""
1414
} else {
1515
assetReader.getAssetAsString(bodyFileName)

0 commit comments

Comments
 (0)