Skip to content

Commit

Permalink
Update MockWebServer tests to depend on generated java protos
Browse files Browse the repository at this point in the history
  • Loading branch information
erawhctim committed Nov 7, 2023
1 parent 09359de commit 5c620eb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion okhttp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ dependencies {
testImplementation(libs.okhttp.mockwebserver)
testImplementation(libs.kotlin.coroutines.test)
testImplementation(project(":extensions:google-java"))
testImplementation(project(":conformance:google-java"))
testImplementation(project(":examples:generated-google-java"))
}

mavenPublishing {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@

package com.connectrpc.okhttp

import com.connectrpc.Code
import com.connectrpc.ProtocolClientConfig
import com.connectrpc.RequestCompression
import com.connectrpc.compression.GzipCompressionPool
import com.connectrpc.conformance.v1.TestServiceClient
import com.connectrpc.conformance.v1.simpleRequest
import com.connectrpc.eliza.v1.ElizaServiceClient
import com.connectrpc.eliza.v1.sayRequest
import com.connectrpc.extensions.GoogleJavaProtobufStrategy
import com.connectrpc.impl.ProtocolClient
import com.connectrpc.protocols.NetworkProtocol
Expand Down Expand Up @@ -63,13 +64,14 @@ class MockWebServerTests {
),
)

val request = simpleRequest {}
TestServiceClient(protocolClient).unaryCall(request)
val response = ElizaServiceClient(protocolClient).say(sayRequest { sentence = "hello" })

mockWebServer.takeRequest().apply {
assertThat(path).isEqualTo("/connectrpc.conformance.v1.TestService/UnaryCall")
assertThat(path).isEqualTo("/connectrpc.eliza.v1.ElizaService/Say")
}

assertThat(response.code).isEqualTo(Code.UNKNOWN)

mockWebServer.shutdown()
}
}

0 comments on commit 5c620eb

Please sign in to comment.