Skip to content

Commit

Permalink
Adding address and port helper (#15)
Browse files Browse the repository at this point in the history
* Making address and port configurable

* Making address and port configurable
  • Loading branch information
gmerinojimenez authored Apr 3, 2023
1 parent f6a2dc3 commit 252a572
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mock/src/main/java/com/telefonica/mock/MockHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.telefonica.mock
import android.content.Context
import com.telefonica.mock.di.DaggerMockComponent
import com.telefonica.mock.di.MockApiModule
import java.net.InetAddress
import javax.inject.Inject

class MockHelper(context: Context) {
Expand All @@ -27,9 +28,9 @@ class MockHelper(context: Context) {

suspend fun getBaseUrl(): String = mockApiClient.getBaseUrl()

suspend fun setUp() {
suspend fun setUp(inetAddress: InetAddress = InetAddress.getByName("localhost"), port: Int = 0) {
mockApiClient.setUp()
mockApiClient.startServer()
mockApiClient.startServer(inetAddress, port)
}

fun enqueue(mock: Mock) {
Expand Down

0 comments on commit 252a572

Please sign in to comment.