Use junit rule for mock webserver

This commit is contained in:
Adam
2021-05-31 11:34:59 -04:00
parent 14545aac26
commit 9e780d58c8
4 changed files with 12 additions and 41 deletions

View File

@@ -28,27 +28,20 @@ import java.io.IOException;
import okhttp3.Request;
import okhttp3.mockwebserver.MockResponse;
import okhttp3.mockwebserver.MockWebServer;
import org.junit.After;
import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
public class RuneLiteAPITest
{
private final MockWebServer server = new MockWebServer();
@Rule
public final MockWebServer server = new MockWebServer();
@Before
public void before() throws IOException
{
server.enqueue(new MockResponse().setBody("OK"));
server.start();
}
@After
public void after() throws IOException
{
server.shutdown();
}
@Test