1
0
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:
Yuri Schimke
2020-11-01 14:12:45 +00:00
committed by GitHub
parent cd2eea07cc
commit c3cd63eae1
3 changed files with 9 additions and 10 deletions

View File

@@ -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)

View File

@@ -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) {
}
}

View File

@@ -108,7 +108,7 @@ public final class ThreadInterruptTest {
interruptLater(500);
try {
call.execute();
fail();
fail("");
} catch (IOException expected) {
}
}