From 85dcc027fd58ffc6634dc5abbba57c4ff27fe0eb Mon Sep 17 00:00:00 2001 From: nosix Date: Tue, 3 Nov 2020 17:26:16 +0900 Subject: [PATCH] Remove the reference to factory variable --- backend-api/src/main/kotlin/com/example/WebServiceFactory.kt | 2 +- .../src/test/kotlin/com/example/backend/CustomerApiTests.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backend-api/src/main/kotlin/com/example/WebServiceFactory.kt b/backend-api/src/main/kotlin/com/example/WebServiceFactory.kt index 8ac559d..4593930 100644 --- a/backend-api/src/main/kotlin/com/example/WebServiceFactory.kt +++ b/backend-api/src/main/kotlin/com/example/WebServiceFactory.kt @@ -43,7 +43,7 @@ class WebServiceFactory(baseUrl: String) { return retrofit.create(service.java) } - suspend fun authenticate(action: suspend () -> Response) { + suspend fun authenticate(action: suspend WebServiceFactory.() -> Response) { val authHeader: String? = action().run { if (isSuccessful) headers().get("Authorization") else null } diff --git a/backend/src/test/kotlin/com/example/backend/CustomerApiTests.kt b/backend/src/test/kotlin/com/example/backend/CustomerApiTests.kt index 0c64460..98c6d77 100644 --- a/backend/src/test/kotlin/com/example/backend/CustomerApiTests.kt +++ b/backend/src/test/kotlin/com/example/backend/CustomerApiTests.kt @@ -40,14 +40,14 @@ class CustomerApiTests { private suspend fun authenticate() { factory.authenticate { - factory.create() + create() .login(Credentials("user", "user_password")) } } private suspend fun authenticateAsAdmin() { factory.authenticate { - factory.create() + create() .login(Credentials("admin", "admin_password")) } }