From cea704d954d44947a9a54c1385b70a05bedfb167 Mon Sep 17 00:00:00 2001 From: Yuri Schimke Date: Sun, 24 Dec 2023 05:30:24 +0000 Subject: [PATCH] Fix android test (#8157) --- .../logging/LoggingEventListenerTest.kt | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/okhttp-logging-interceptor/src/test/java/okhttp3/logging/LoggingEventListenerTest.kt b/okhttp-logging-interceptor/src/test/java/okhttp3/logging/LoggingEventListenerTest.kt index 2a01101b2..1d832e802 100644 --- a/okhttp-logging-interceptor/src/test/java/okhttp3/logging/LoggingEventListenerTest.kt +++ b/okhttp-logging-interceptor/src/test/java/okhttp3/logging/LoggingEventListenerTest.kt @@ -82,18 +82,18 @@ class LoggingEventListenerTest { assertThat(response.body).isNotNull() response.body.bytes() logRecorder - .assertLogMatch(Regex("""callStart: Request\{method=GET, url=$url}""")) + .assertLogMatch(Regex("""callStart: Request\{method=GET, url=$url\}""")) .assertLogMatch(Regex("""proxySelectStart: $url""")) .assertLogMatch(Regex("""proxySelectEnd: \[DIRECT]""")) .assertLogMatch(Regex("""dnsStart: ${url.host}""")) .assertLogMatch(Regex("""dnsEnd: \[.+]""")) .assertLogMatch(Regex("""connectStart: ${url.host}/.+ DIRECT""")) .assertLogMatch(Regex("""connectEnd: http/1.1""")) - .assertLogMatch(Regex("""connectionAcquired: Connection\{${url.host}:\d+, proxy=DIRECT hostAddress=${url.host}/.+ cipherSuite=none protocol=http/1\.1}""")) + .assertLogMatch(Regex("""connectionAcquired: Connection\{${url.host}:\d+, proxy=DIRECT hostAddress=${url.host}/.+ cipherSuite=none protocol=http/1\.1\}""")) .assertLogMatch(Regex("""requestHeadersStart""")) .assertLogMatch(Regex("""requestHeadersEnd""")) .assertLogMatch(Regex("""responseHeadersStart""")) - .assertLogMatch(Regex("""responseHeadersEnd: Response\{protocol=http/1\.1, code=200, message=OK, url=$url}""")) + .assertLogMatch(Regex("""responseHeadersEnd: Response\{protocol=http/1\.1, code=200, message=OK, url=$url\}""")) .assertLogMatch(Regex("""responseBodyStart""")) .assertLogMatch(Regex("""responseBodyEnd: byteCount=6""")) .assertLogMatch(Regex("""connectionReleased""")) @@ -107,20 +107,20 @@ class LoggingEventListenerTest { server.enqueue(MockResponse()) client.newCall(request().post("Hello!".toRequestBody(PLAIN)).build()).execute() logRecorder - .assertLogMatch(Regex("""callStart: Request\{method=POST, url=$url}""")) + .assertLogMatch(Regex("""callStart: Request\{method=POST, url=$url\}""")) .assertLogMatch(Regex("""proxySelectStart: $url""")) .assertLogMatch(Regex("""proxySelectEnd: \[DIRECT]""")) .assertLogMatch(Regex("""dnsStart: ${url.host}""")) .assertLogMatch(Regex("""dnsEnd: \[.+]""")) .assertLogMatch(Regex("""connectStart: ${url.host}/.+ DIRECT""")) .assertLogMatch(Regex("""connectEnd: http/1.1""")) - .assertLogMatch(Regex("""connectionAcquired: Connection\{${url.host}:\d+, proxy=DIRECT hostAddress=${url.host}/.+ cipherSuite=none protocol=http/1\.1}""")) + .assertLogMatch(Regex("""connectionAcquired: Connection\{${url.host}:\d+, proxy=DIRECT hostAddress=${url.host}/.+ cipherSuite=none protocol=http/1\.1\}""")) .assertLogMatch(Regex("""requestHeadersStart""")) .assertLogMatch(Regex("""requestHeadersEnd""")) .assertLogMatch(Regex("""requestBodyStart""")) .assertLogMatch(Regex("""requestBodyEnd: byteCount=6""")) .assertLogMatch(Regex("""responseHeadersStart""")) - .assertLogMatch(Regex("""responseHeadersEnd: Response\{protocol=http/1\.1, code=200, message=OK, url=$url}""")) + .assertLogMatch(Regex("""responseHeadersEnd: Response\{protocol=http/1\.1, code=200, message=OK, url=$url\}""")) .assertLogMatch(Regex("""responseBodyStart""")) .assertLogMatch(Regex("""responseBodyEnd: byteCount=0""")) .assertLogMatch(Regex("""connectionReleased""")) @@ -139,20 +139,20 @@ class LoggingEventListenerTest { response.body.bytes() platform.assumeHttp2Support() logRecorder - .assertLogMatch(Regex("""callStart: Request\{method=GET, url=$url}""")) + .assertLogMatch(Regex("""callStart: Request\{method=GET, url=$url\}""")) .assertLogMatch(Regex("""proxySelectStart: $url""")) .assertLogMatch(Regex("""proxySelectEnd: \[DIRECT]""")) .assertLogMatch(Regex("""dnsStart: ${url.host}""")) .assertLogMatch(Regex("""dnsEnd: \[.+]""")) .assertLogMatch(Regex("""connectStart: ${url.host}/.+ DIRECT""")) .assertLogMatch(Regex("""secureConnectStart""")) - .assertLogMatch(Regex("""secureConnectEnd: Handshake\{tlsVersion=TLS_1_[23] cipherSuite=TLS_.* peerCertificates=\[CN=localhost] localCertificates=\[]}""")) + .assertLogMatch(Regex("""secureConnectEnd: Handshake\{tlsVersion=TLS_1_[23] cipherSuite=TLS_.* peerCertificates=\[CN=localhost] localCertificates=\[]\}""")) .assertLogMatch(Regex("""connectEnd: h2""")) - .assertLogMatch(Regex("""connectionAcquired: Connection\{${url.host}:\d+, proxy=DIRECT hostAddress=${url.host}/.+ cipherSuite=.+ protocol=h2}""")) + .assertLogMatch(Regex("""connectionAcquired: Connection\{${url.host}:\d+, proxy=DIRECT hostAddress=${url.host}/.+ cipherSuite=.+ protocol=h2\}""")) .assertLogMatch(Regex("""requestHeadersStart""")) .assertLogMatch(Regex("""requestHeadersEnd""")) .assertLogMatch(Regex("""responseHeadersStart""")) - .assertLogMatch(Regex("""responseHeadersEnd: Response\{protocol=h2, code=200, message=, url=$url}""")) + .assertLogMatch(Regex("""responseHeadersEnd: Response\{protocol=h2, code=200, message=, url=$url\}""")) .assertLogMatch(Regex("""responseBodyStart""")) .assertLogMatch(Regex("""responseBodyEnd: byteCount=0""")) .assertLogMatch(Regex("""connectionReleased""")) @@ -172,7 +172,7 @@ class LoggingEventListenerTest { } catch (expected: UnknownHostException) { } logRecorder - .assertLogMatch(Regex("""callStart: Request\{method=GET, url=$url}""")) + .assertLogMatch(Regex("""callStart: Request\{method=GET, url=$url\}""")) .assertLogMatch(Regex("""proxySelectStart: $url""")) .assertLogMatch(Regex("""proxySelectEnd: \[DIRECT]""")) .assertLogMatch(Regex("""dnsStart: ${url.host}""")) @@ -197,7 +197,7 @@ class LoggingEventListenerTest { } catch (expected: IOException) { } logRecorder - .assertLogMatch(Regex("""callStart: Request\{method=GET, url=$url}""")) + .assertLogMatch(Regex("""callStart: Request\{method=GET, url=$url\}""")) .assertLogMatch(Regex("""proxySelectStart: $url""")) .assertLogMatch(Regex("""proxySelectEnd: \[DIRECT]""")) .assertLogMatch(Regex("""dnsStart: ${url.host}""")) @@ -222,10 +222,10 @@ class LoggingEventListenerTest { listener.cacheMiss(call) listener.satisfactionFailure(call, response) logRecorder - .assertLogMatch(Regex("""cacheConditionalHit: Response\{protocol=h2, code=200, message=, url=$url}""")) - .assertLogMatch(Regex("""cacheHit: Response\{protocol=h2, code=200, message=, url=$url}""")) + .assertLogMatch(Regex("""cacheConditionalHit: Response\{protocol=h2, code=200, message=, url=$url\}""")) + .assertLogMatch(Regex("""cacheHit: Response\{protocol=h2, code=200, message=, url=$url\}""")) .assertLogMatch(Regex("""cacheMiss""")) - .assertLogMatch(Regex("""satisfactionFailure: Response\{protocol=h2, code=200, message=, url=$url}""")) + .assertLogMatch(Regex("""satisfactionFailure: Response\{protocol=h2, code=200, message=, url=$url\}""")) .assertNoMoreLogs() }