mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-25 13:01:03 +00:00
Run Spotless on src/test
This commit is contained in:
parent
6d9a81ba1c
commit
e636fda14f
@ -3,6 +3,7 @@ package io.grasscutter;
|
|||||||
import com.mchange.util.AssertException;
|
import com.mchange.util.AssertException;
|
||||||
import emu.grasscutter.Grasscutter;
|
import emu.grasscutter.Grasscutter;
|
||||||
import emu.grasscutter.config.Configuration;
|
import emu.grasscutter.config.Configuration;
|
||||||
|
import java.io.IOException;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
import okhttp3.Request;
|
import okhttp3.Request;
|
||||||
@ -11,14 +12,9 @@ import org.junit.jupiter.api.BeforeAll;
|
|||||||
import org.junit.jupiter.api.DisplayName;
|
import org.junit.jupiter.api.DisplayName;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.io.IOException;
|
/** Testing entrypoint for {@link Grasscutter}. */
|
||||||
|
|
||||||
/**
|
|
||||||
* Testing entrypoint for {@link Grasscutter}.
|
|
||||||
*/
|
|
||||||
public final class GrasscutterTest {
|
public final class GrasscutterTest {
|
||||||
@Getter private static final OkHttpClient httpClient
|
@Getter private static final OkHttpClient httpClient = new OkHttpClient();
|
||||||
= new OkHttpClient();
|
|
||||||
|
|
||||||
@Getter private static int httpPort = -1;
|
@Getter private static int httpPort = -1;
|
||||||
@Getter private static int gamePort = -1;
|
@Getter private static int gamePort = -1;
|
||||||
@ -37,7 +33,7 @@ public final class GrasscutterTest {
|
|||||||
public static void main() {
|
public static void main() {
|
||||||
try {
|
try {
|
||||||
// Start Grasscutter.
|
// Start Grasscutter.
|
||||||
Grasscutter.main(new String[]{"-test"});
|
Grasscutter.main(new String[] {"-test"});
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
throw new AssertException("Grasscutter failed to start.");
|
throw new AssertException("Grasscutter failed to start.");
|
||||||
}
|
}
|
||||||
@ -51,13 +47,10 @@ public final class GrasscutterTest {
|
|||||||
@DisplayName("HTTP server check")
|
@DisplayName("HTTP server check")
|
||||||
public void checkHttpServer() {
|
public void checkHttpServer() {
|
||||||
// Create a request.
|
// Create a request.
|
||||||
var request = new Request.Builder()
|
var request = new Request.Builder().url(GrasscutterTest.http("")).build();
|
||||||
.url(GrasscutterTest.http(""))
|
|
||||||
.build();
|
|
||||||
|
|
||||||
// Perform the request.
|
// Perform the request.
|
||||||
try (var response = GrasscutterTest.httpClient
|
try (var response = GrasscutterTest.httpClient.newCall(request).execute()) {
|
||||||
.newCall(request).execute()) {
|
|
||||||
// Check the response.
|
// Check the response.
|
||||||
Assertions.assertTrue(response.isSuccessful());
|
Assertions.assertTrue(response.isSuccessful());
|
||||||
} catch (IOException exception) {
|
} catch (IOException exception) {
|
||||||
|
Loading…
Reference in New Issue
Block a user