mirror of
https://github.com/square/okhttp.git
synced 2026-01-14 07:22:20 +03:00
Move http tests to Junit 5 (#6377)
This commit is contained in:
@@ -18,16 +18,15 @@ package okhttp3.internal.http
|
||||
import java.util.Date
|
||||
import java.util.TimeZone
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.jupiter.api.AfterEach
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class HttpDateTest {
|
||||
|
||||
private lateinit var originalDefault: TimeZone
|
||||
|
||||
@Before
|
||||
@Throws(Exception::class)
|
||||
@BeforeEach
|
||||
fun setUp() {
|
||||
originalDefault = TimeZone.getDefault()
|
||||
// The default timezone should affect none of these tests: HTTP specified GMT, so we set it to
|
||||
@@ -35,7 +34,7 @@ class HttpDateTest {
|
||||
TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles"))
|
||||
}
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
@Throws(Exception::class)
|
||||
fun tearDown() {
|
||||
TimeZone.setDefault(originalDefault)
|
||||
|
||||
@@ -18,10 +18,10 @@ package okhttp3.internal.http;
|
||||
import java.io.IOException;
|
||||
import java.net.ProtocolException;
|
||||
import okhttp3.Protocol;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
public final class StatusLineTest {
|
||||
@Test public void parse() throws IOException {
|
||||
@@ -111,7 +111,7 @@ public final class StatusLineTest {
|
||||
private void assertInvalid(String statusLine) throws IOException {
|
||||
try {
|
||||
StatusLine.Companion.parse(statusLine);
|
||||
fail();
|
||||
fail("");
|
||||
} catch (ProtocolException expected) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ public final class ThreadInterruptTest {
|
||||
interruptLater(500);
|
||||
try {
|
||||
call.execute();
|
||||
fail();
|
||||
fail("");
|
||||
} catch (IOException expected) {
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user