square / okhttp

Square’s meticulous HTTP client for the JVM, Android, and GraalVM.
https://square.github.io/okhttp/
Apache License 2.0
45.71k stars 9.15k forks source link

okhttp3.mockwebserver 4.12.0 #8539

Closed mohamed928 closed 1 day ago

mohamed928 commented 2 days ago

Hello Community, Please Im having an issue can't figure what Im missing:

RecordedRequest request = server.takeRequest(); request.getBody().readUtf8()

Intellij, spring boot unit test is telling me can't resolve method readUtf8

any help will be greatly appreciated

This is the decompiled RecordedRequest.class. I dont see readUtf8 issue-mockwebserver

yschimke commented 1 day ago

You should check you are using a consistent version of all okhttp modules. But not something we can directly help with

mohamed928 commented 1 day ago

not sure exactly what module you eventually referring to but here is the project dependency tree

[INFO] | +- org.springframework.boot:spring-boot-starter:jar:3.2.9:compile [INFO] | | +- org.springframework.boot:spring-boot:jar:3.2.9:compile [INFO] | | +- org.springframework.boot:spring-boot-autoconfigure:jar:3.2.9:compile [INFO] | | +- org.springframework.boot:spring-boot-starter-logging:jar:3.2.9:compile [INFO] | | | +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.21.1:compile [INFO] | | | - org.slf4j:jul-to-slf4j:jar:2.0.16:compile [INFO] | | +- jakarta.annotation:jakarta.annotation-api:jar:2.1.1:compile [INFO] | | - org.yaml:snakeyaml:jar:2.2:compile [INFO] | +- org.springframework.boot:spring-boot-starter-json:jar:3.2.9:compile [INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.15.4:compile [INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.15.4:compile [INFO] | | - com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.15.4:compile [INFO] | +- org.springframework.boot:spring-boot-starter-aop:jar:3.2.9:compile [INFO] | | +- org.springframework:spring-aop:jar:6.1.12:compile [INFO] | | - org.aspectj:aspectjweaver:jar:1.9.22.1:compile [INFO] | +- com.fasterxml.jackson.core:jackson-databind:jar:2.15.4:compile [INFO] | | - com.fasterxml.jackson.core:jackson-annotations:jar:2.15.4:compile [INFO] | +- com.fasterxml.jackson.dataformat:jackson-dataformat-csv:jar:2.15.4:compile [INFO] | +- net.logstash.logback:logstash-logback-encoder:jar:7.0.1:compile [INFO] | +- org.apache.poi:poi:jar:5.3.0:compile [INFO] | | +- commons-codec:commons-codec:jar:1.16.1:compile [INFO] | | +- org.apache.commons:commons-collections4:jar:4.4:compile [INFO] | | +- org.apache.commons:commons-math3:jar:3.6.1:compile [INFO] | | +- commons-io:commons-io:jar:2.16.1:compile [INFO] | | +- com.zaxxer:SparseBitSet:jar:1.3:compile [INFO] | | - org.apache.logging.log4j:log4j-api:jar:2.21.1:compile [INFO] | +- org.apache.poi:poi-ooxml:jar:5.3.0:compile [INFO] | | +- org.apache.poi:poi-ooxml-lite:jar:5.3.0:compile [INFO] | | +- org.apache.xmlbeans:xmlbeans:jar:5.2.1:compile [INFO] | | +- org.apache.commons:commons-compress:jar:1.26.2:compile [INFO] | | - com.github.virtuald:curvesapi:jar:1.08:compile [INFO] | - org.apache.commons:commons-lang3:jar:3.13.0:compile [INFO] +- org.springframework.boot:spring-boot-starter-web:jar:3.2.9:compile [INFO] | +- org.springframework.boot:spring-boot-starter-tomcat:jar:3.2.9:compile [INFO] | | +- org.apache.tomcat.embed:tomcat-embed-core:jar:10.1.28:compile [INFO] | | - org.apache.tomcat.embed:tomcat-embed-websocket:jar:10.1.28:compile [INFO] | +- org.springframework:spring-web:jar:6.1.12:compile [INFO] | | +- org.springframework:spring-beans:jar:6.1.12:compile [INFO] | | - io.micrometer:micrometer-observation:jar:1.12.9:compile [INFO] | | - io.micrometer:micrometer-commons:jar:1.12.9:compile [INFO] | - org.springframework:spring-webmvc:jar:6.1.12:compile [INFO] | +- org.springframework:spring-context:jar:6.1.12:compile [INFO] | - org.springframework:spring-expression:jar:6.1.12:compile [INFO] +- org.springframework.boot:spring-boot-starter-webflux:jar:3.2.9:compile [INFO] | +- org.springframework.boot:spring-boot-starter-reactor-netty:jar:3.2.9:compile [INFO] | | - io.projectreactor.netty:reactor-netty-http:jar:1.1.22:compile [INFO] | | +- io.netty:netty-codec-http:jar:4.1.112.Final:compile [INFO] | | | +- io.netty:netty-common:jar:4.1.112.Final:compile [INFO] | | | +- io.netty:netty-buffer:jar:4.1.112.Final:compile [INFO] | | | +- io.netty:netty-transport:jar:4.1.112.Final:compile [INFO] | | | +- io.netty:netty-codec:jar:4.1.112.Final:compile [INFO] | | | - io.netty:netty-handler:jar:4.1.112.Final:compile [INFO] | | +- io.netty:netty-codec-http2:jar:4.1.112.Final:compile [INFO] | | +- io.netty:netty-resolver-dns:jar:4.1.112.Final:compile [INFO] | | | +- io.netty:netty-resolver:jar:4.1.112.Final:compile [INFO] | | | - io.netty:netty-codec-dns:jar:4.1.112.Final:compile [INFO] | | +- io.netty:netty-resolver-dns-native-macos:jar:osx-x86_64:4.1.112.Final:compile [INFO] | | | - io.netty:netty-resolver-dns-classes-macos:jar:4.1.112.Final:compile [INFO] | | +- io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.112.Final:compile [INFO] | | | +- io.netty:netty-transport-native-unix-common:jar:4.1.112.Final:compile [INFO] | | | - io.netty:netty-transport-classes-epoll:jar:4.1.112.Final:compile [INFO] | | - io.projectreactor.netty:reactor-netty-core:jar:1.1.22:compile [INFO] | | - io.netty:netty-handler-proxy:jar:4.1.112.Final:compile [INFO] | | - io.netty:netty-codec-socks:jar:4.1.112.Final:compile [INFO] | - org.springframework:spring-webflux:jar:6.1.12:compile [INFO] | - io.projectreactor:reactor-core:jar:3.6.9:compile [INFO] | - org.reactivestreams:reactive-streams:jar:1.0.4:compile [INFO] +- org.springframework.boot:spring-boot-starter-amqp:jar:3.2.9:compile [INFO] | +- org.springframework:spring-messaging:jar:6.1.12:compile [INFO] | - org.springframework.amqp:spring-rabbit:jar:3.1.7:compile [INFO] | +- org.springframework.amqp:spring-amqp:jar:3.1.7:compile [INFO] | | - org.springframework.retry:spring-retry:jar:2.0.8:compile [INFO] | +- com.rabbitmq:amqp-client:jar:5.19.0:compile [INFO] | - org.springframework:spring-tx:jar:6.1.12:compile [INFO] +- org.springframework.boot:spring-boot-starter-validation:jar:3.2.9:compile [INFO] | +- org.apache.tomcat.embed:tomcat-embed-el:jar:10.1.28:compile [INFO] | - org.hibernate.validator:hibernate-validator:jar:8.0.1.Final:compile [INFO] | +- jakarta.validation:jakarta.validation-api:jar:3.0.2:compile [INFO] | +- org.jboss.logging:jboss-logging:jar:3.5.3.Final:compile [INFO] | - com.fasterxml:classmate:jar:1.6.0:compile [INFO] +- org.springframework.boot:spring-boot-configuration-processor:jar:3.2.9:compile (optional) [INFO] +- org.springframework.boot:spring-boot-starter-freemarker:jar:3.2.9:compile [INFO] | +- org.freemarker:freemarker:jar:2.3.33:compile [INFO] | - org.springframework:spring-context-support:jar:6.1.12:compile [INFO] +- org.projectlombok:lombok:jar:1.18.34:compile [INFO] +- com.fasterxml.jackson.core:jackson-core:jar:2.13.1:compile [INFO] +- ch.qos.logback:logback-access:jar:1.4.14:compile [INFO] +- ch.qos.logback:logback-classic:jar:1.4.14:compile [INFO] | - org.slf4j:slf4j-api:jar:2.0.16:compile [INFO] +- ch.qos.logback:logback-core:jar:1.4.14:compile [INFO] +- org.apache.commons:commons-configuration2:jar:2.7:compile [INFO] | +- org.apache.commons:commons-text:jar:1.8:compile [INFO] | - commons-logging:commons-logging:jar:1.2:compile [INFO] +- commons-beanutils:commons-beanutils:jar:1.9.4:compile [INFO] | - commons-collections:commons-collections:jar:3.2.2:compile [INFO] +- org.springframework.boot:spring-boot-starter-test:jar:3.2.9:test [INFO] | +- org.springframework.boot:spring-boot-test:jar:3.2.9:test [INFO] | +- org.springframework.boot:spring-boot-test-autoconfigure:jar:3.2.9:test [INFO] | +- com.jayway.jsonpath:json-path:jar:2.9.0:test [INFO] | +- jakarta.xml.bind:jakarta.xml.bind-api:jar:4.0.2:test [INFO] | | - jakarta.activation:jakarta.activation-api:jar:2.1.3:test [INFO] | +- net.minidev:json-smart:jar:2.5.1:test [INFO] | | - net.minidev:accessors-smart:jar:2.5.1:test [INFO] | | - org.ow2.asm:asm:jar:9.6:test [INFO] | +- org.assertj:assertj-core:jar:3.24.2:test [INFO] | +- org.awaitility:awaitility:jar:4.2.2:test [INFO] | +- org.hamcrest:hamcrest:jar:2.2:test [INFO] | +- org.mockito:mockito-junit-jupiter:jar:5.7.0:test [INFO] | +- org.skyscreamer:jsonassert:jar:1.5.3:test [INFO] | | - com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test [INFO] | +- org.springframework:spring-core:jar:6.1.12:compile [INFO] | | - org.springframework:spring-jcl:jar:6.1.12:compile [INFO] | +- org.springframework:spring-test:jar:6.1.12:test [INFO] | - org.xmlunit:xmlunit-core:jar:2.9.1:test [INFO] +- org.junit.jupiter:junit-jupiter:jar:5.10.3:test [INFO] | +- org.junit.jupiter:junit-jupiter-api:jar:5.10.3:test [INFO] | | +- org.opentest4j:opentest4j:jar:1.3.0:test [INFO] | | +- org.junit.platform:junit-platform-commons:jar:1.10.3:test [INFO] | | - org.apiguardian:apiguardian-api:jar:1.1.2:test [INFO] | +- org.junit.jupiter:junit-jupiter-params:jar:5.10.3:test [INFO] | - org.junit.jupiter:junit-jupiter-engine:jar:5.10.3:test [INFO] | - org.junit.platform:junit-platform-engine:jar:1.10.3:test [INFO] +- com.flextrade.jfixture:jfixture:jar:2.7.2:test [INFO] +- org.mockito:mockito-core:jar:5.7.0:test [INFO] | +- net.bytebuddy:byte-buddy:jar:1.14.19:test [INFO] | +- net.bytebuddy:byte-buddy-agent:jar:1.14.19:test [INFO] | - org.objenesis:objenesis:jar:3.3:test [INFO] +- org.jsoup:jsoup:jar:1.14.3:test [INFO] +- com.squareup.okhttp3:okhttp:jar:4.12.0:test [INFO] | +- com.squareup.okio:okio:jar:3.6.0:test [INFO] | | - com.squareup.okio:okio-jvm:jar:3.6.0:test [INFO] | | - org.jetbrains.kotlin:kotlin-stdlib-common:jar:1.9.25:test [INFO] | - org.jetbrains.kotlin:kotlin-stdlib-jdk8:jar:1.9.25:test [INFO] | +- org.jetbrains.kotlin:kotlin-stdlib:jar:1.9.25:test [INFO] | | - org.jetbrains:annotations:jar:13.0:test [INFO] | - org.jetbrains.kotlin:kotlin-stdlib-jdk7:jar:1.9.25:test [INFO] - com.squareup.okhttp3:mockwebserver:jar:4.12.0:test [INFO] - junit:junit:jar:4.13.2:test [INFO] - org.hamcrest:hamcrest-core:jar:2.2:test

yschimke commented 1 day ago

readUtf8 is a method on okio Buffer. Not RecordedRequest.

But please consider using a site like stackoverflow for general build issues. We can't provide 1:1 support.