- Sort Score
- Num 10 results
- Language All
Results 11 - 20 of 118 for MockWebServer (0.61 seconds)
-
maven-tests/src/test/java/com/squareup/okhttp3/maventest/AppTest.java
import mockwebserver3.MockResponse; import mockwebserver3.MockWebServer; import okhttp3.Headers; import org.junit.Test; import java.io.IOException; /** * Unit test for simple App. */ public class AppTest { private final MockWebServer mockWebServer = new MockWebServer(); @Test public void testApp() throws IOException { mockWebServer.enqueue(new MockResponse(200, Headers.of(), "Hello, Maven!"));Created: Fri Apr 03 11:42:14 GMT 2026 - Last Modified: Sat Jul 12 12:05:57 GMT 2025 - 1.1K bytes - Click Count (0) -
mockwebserver-junit4/README.md
MockWebServer for JUnit 4 ========================= This module integrates mockwebserver3.MockWebServer with JUnit 4. To use, first add this library as a test dependency: ``` testImplementation("com.squareup.okhttp3:mockwebserver3-junit4:5.3.0") ``` Then in tests annotated `@org.junit.Test`, you may declare a field with the `@Rule` annotation: ``` @Rule public final MockWebServerRule serverRule = new MockWebServerRule(); ```Created: Fri Apr 03 11:42:14 GMT 2026 - Last Modified: Thu Oct 30 21:39:59 GMT 2025 - 706 bytes - Click Count (0) -
mockwebserver-junit4/src/main/kotlin/mockwebserver3/junit4/MockWebServerRule.kt
* limitations under the License. */ package mockwebserver3.junit4 import java.io.IOException import mockwebserver3.MockWebServer import org.junit.rules.ExternalResource /** * Runs MockWebServer for the duration of a single test method. * * In Java JUnit 4 tests (ie. tests annotated `@org.junit.Test`), use this by defining a field with * the `@Rule` annotation: *
Created: Fri Apr 03 11:42:14 GMT 2026 - Last Modified: Mon Jun 16 22:36:18 GMT 2025 - 1.4K bytes - Click Count (0) -
mockwebserver/README.md
### Example Use MockWebServer the same way that you use mocking frameworks like [Mockito](https://github.com/mockito/mockito): 1. Script the mocks. 2. Run application code. 3. Verify that the expected requests were made. Here's a complete example: ### Java ```java public void test() throws Exception { // Create a MockWebServer. These are lean enough that you can create a new
Created: Fri Apr 03 11:42:14 GMT 2026 - Last Modified: Thu Oct 30 21:39:59 GMT 2025 - 8.1K bytes - Click Count (0) -
samples/unixdomainsockets/src/main/java/okhttp3/unixdomainsockets/ClientAndServer.java
import java.util.Collections; import okhttp3.OkHttpClient; import okhttp3.Protocol; import okhttp3.Request; import okhttp3.Response; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; /** * Create UNIX domain sockets for MockWebServer and OkHttp and connect 'em together. Note that we * cannot do TLS over domain sockets. */ public class ClientAndServer { public void run() throws Exception {
Created: Fri Apr 03 11:42:14 GMT 2026 - Last Modified: Mon Dec 24 03:46:30 GMT 2018 - 2.1K bytes - Click Count (0) -
mockwebserver/src/test/java/mockwebserver3/MockWebServerTest.kt
} } @Test fun toStringIncludesLifecycleState() { val other = MockWebServer() assertThat(other.toString()).isEqualTo("MockWebServer{new}") other.use { other.start() assertThat(other.toString()).isEqualTo("MockWebServer{port=${other.port}}") } assertThat(other.toString()).isEqualTo("MockWebServer{closed}") } @Test fun closeWhileBlockedDispatching() {
Created: Fri Apr 03 11:42:14 GMT 2026 - Last Modified: Sun Aug 03 22:38:00 GMT 2025 - 28K bytes - Click Count (0) -
module-tests/src/test/java/okhttp3/modules/test/JavaModuleTest.java
OkHttpCaller.callOkHttp(HttpUrl.get("https://square.com/robots.txt")); } @Test public void testMockWebServer() throws IOException { MockWebServer server = new MockWebServer(); server.enqueue(new MockResponse(200, Headers.of(), "Hello, Java9!")); server.start(); // Just check we can run code that depends on OkHttp types
Created: Fri Apr 03 11:42:14 GMT 2026 - Last Modified: Sun Sep 21 06:22:22 GMT 2025 - 2.1K bytes - Click Count (0) -
mockwebserver-junit5/src/main/kotlin/mockwebserver3/junit5/internal/StartStopExtension.kt
* See the License for the specific language governing permissions and * limitations under the License. */ package mockwebserver3.junit5.internal import java.lang.reflect.Modifier import mockwebserver3.MockWebServer import mockwebserver3.junit5.StartStop import okhttp3.internal.SuppressSignatureCheck import org.junit.jupiter.api.extension.BeforeAllCallback import org.junit.jupiter.api.extension.BeforeEachCallback
Created: Fri Apr 03 11:42:14 GMT 2026 - Last Modified: Tue Feb 03 22:17:59 GMT 2026 - 2.4K bytes - Click Count (0) -
mockwebserver-deprecated/src/main/java9/module-info.java
@SuppressWarnings("module") module okhttp3.mockwebserver { requires okhttp3; exports okhttp3.mockwebserver; requires java.logging;Created: Fri Apr 03 11:42:14 GMT 2026 - Last Modified: Sun Sep 21 06:22:22 GMT 2025 - 139 bytes - Click Count (0) -
mockwebserver/src/test/java/mockwebserver3/CustomDispatcherTest.kt
import mockwebserver3.junit5.StartStop import org.junit.jupiter.api.Test import org.junit.jupiter.api.Timeout @Timeout(30) class CustomDispatcherTest { @StartStop private val mockWebServer = MockWebServer() @Test fun simpleDispatch() { val requestsMade = mutableListOf<RecordedRequest>() val dispatcher: Dispatcher = object : Dispatcher() {Created: Fri Apr 03 11:42:14 GMT 2026 - Last Modified: Wed Jun 18 12:28:21 GMT 2025 - 3.2K bytes - Click Count (1)