-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e7aeb37
commit 3dad0fd
Showing
1 changed file
with
36 additions
and
1 deletion.
There are no files selected for viewing
37 changes: 36 additions & 1 deletion
37
src/test/java/org/kiwiproject/test/okhttp3/mockwebserver/MockWebServersTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,44 @@ | ||
package org.kiwiproject.test.okhttp3.mockwebserver; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import okhttp3.mockwebserver.MockWebServer; | ||
import org.junit.jupiter.api.AfterEach; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Nested; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.ValueSource; | ||
import org.kiwiproject.io.KiwiIO; | ||
|
||
import java.io.IOException; | ||
import java.net.URI; | ||
|
||
@DisplayName("MockWebServers") | ||
class MockWebServersTest { | ||
|
||
// TODO | ||
private MockWebServer server; | ||
|
||
@BeforeEach | ||
void setUp() throws IOException { | ||
server = new MockWebServer(); | ||
server.start(); | ||
} | ||
|
||
@AfterEach | ||
void tearDown() { | ||
KiwiIO.closeQuietly(server); | ||
} | ||
|
||
@Nested | ||
class UriMethod { | ||
|
||
@ParameterizedTest | ||
@ValueSource(strings = { "", "/", "/status", "/status/", "/users/active" }) | ||
void shouldCreateUri_WithPath(String path) { | ||
var url = server.url(path).toString(); | ||
var expectedUri = URI.create(url); | ||
assertThat(MockWebServers.uri(server, path)).isEqualTo(expectedUri); | ||
} | ||
} | ||
} |