feat: don't skip tests
This commit is contained in:
parent
16696bb349
commit
d169e32857
4 changed files with 39 additions and 106 deletions
|
@ -18,10 +18,7 @@
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<version>2.12.4</version>
|
<version>3.0.0-M7</version>
|
||||||
<configuration>
|
|
||||||
<skipTests>true</skipTests>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
|
@ -57,6 +54,10 @@
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
<repositories>
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>papermc</id>
|
||||||
|
<url>https://repo.papermc.io/repository/maven-public/</url>
|
||||||
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>xenondevs</id>
|
<id>xenondevs</id>
|
||||||
<url>https://repo.xenondevs.xyz/releases</url>
|
<url>https://repo.xenondevs.xyz/releases</url>
|
||||||
|
@ -110,25 +111,47 @@
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.junit.jupiter</groupId>
|
<groupId>com.github.seeseemelk</groupId>
|
||||||
<artifactId>junit-jupiter</artifactId>
|
<artifactId>MockBukkit-v1.19</artifactId>
|
||||||
<version>5.9.0</version>
|
<version>2.29.0</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<artifactId>junit-jupiter-api</artifactId>
|
<artifactId>paper-api</artifactId>
|
||||||
|
<groupId>io.papermc.paper</groupId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>junit-jupiter</artifactId>
|
||||||
<groupId>org.junit.jupiter</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
</exclusion>
|
</exclusion>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<artifactId>junit-jupiter-params</artifactId>
|
<artifactId>hamcrest-library</artifactId>
|
||||||
<groupId>org.junit.jupiter</groupId>
|
<groupId>org.hamcrest</groupId>
|
||||||
</exclusion>
|
</exclusion>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<artifactId>junit-jupiter-engine</artifactId>
|
<artifactId>adventure-platform-bungeecord</artifactId>
|
||||||
<groupId>org.junit.jupiter</groupId>
|
<groupId>net.kyori</groupId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>maven-resolver-provider</artifactId>
|
||||||
|
<groupId>org.apache.maven</groupId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>maven-resolver-connector-basic</artifactId>
|
||||||
|
<groupId>org.apache.maven.resolver</groupId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>maven-resolver-transport-http</artifactId>
|
||||||
|
<groupId>org.apache.maven.resolver</groupId>
|
||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mariadb.jdbc</groupId>
|
||||||
|
<artifactId>mariadb-java-client</artifactId>
|
||||||
|
<version>3.1.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.target>17</maven.compiler.target>
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
|
|
@ -113,10 +113,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<version>2.12.4</version>
|
<version>3.0.0-M7</version>
|
||||||
<configuration>
|
|
||||||
<skipTests>true</skipTests>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
|
|
@ -1,87 +0,0 @@
|
||||||
package net.artelnatif.nicko.test;
|
|
||||||
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
import com.google.gson.JsonParser;
|
|
||||||
import net.artelnatif.nicko.mojang.MojangAPI;
|
|
||||||
import net.artelnatif.nicko.mojang.MojangSkin;
|
|
||||||
import org.junit.jupiter.api.Assertions;
|
|
||||||
import org.junit.jupiter.api.DisplayName;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
import javax.net.ssl.HttpsURLConnection;
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.concurrent.ExecutionException;
|
|
||||||
|
|
||||||
public class MojangAPITest {
|
|
||||||
public static final String NAME = "Notch";
|
|
||||||
public static final String URL_NAME = "https://api.mojang.com/users/profiles/minecraft/{name}";
|
|
||||||
public static final String URL_SKIN = "https://sessionserver.mojang.com/session/minecraft/profile/{uuid}?unsigned=false";
|
|
||||||
|
|
||||||
public static JsonObject object = null;
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@DisplayName("MojangAPI - GET - Name")
|
|
||||||
public void testGetMojangAPIName() throws IOException {
|
|
||||||
final URL url = new URL(URL_NAME.replace("{name}", NAME));
|
|
||||||
final HttpsURLConnection urlConnection = (HttpsURLConnection) url.openConnection();
|
|
||||||
urlConnection.setRequestMethod("GET");
|
|
||||||
urlConnection.setDoOutput(true);
|
|
||||||
|
|
||||||
//DataOutputStream output = new DataOutputStream(urlConnection.getOutputStream());
|
|
||||||
//output.writeBytes();
|
|
||||||
//output.flush();
|
|
||||||
//output.close();
|
|
||||||
|
|
||||||
final BufferedReader in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
|
|
||||||
final StringBuilder response = new StringBuilder();
|
|
||||||
String inputLine;
|
|
||||||
|
|
||||||
while ((inputLine = in.readLine()) != null) {
|
|
||||||
response.append(inputLine);
|
|
||||||
}
|
|
||||||
in.close();
|
|
||||||
object = JsonParser.parseString(response.toString()).getAsJsonObject();
|
|
||||||
Assertions.assertEquals(NAME, object.get("name").getAsString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@DisplayName("MojangAPI - GET - Skin")
|
|
||||||
public void testGetMojangAPISkin() throws IOException {
|
|
||||||
final URL url = new URL(URL_SKIN.replace("{uuid}", object.get("id").getAsString().replaceAll("-", "")));
|
|
||||||
final HttpsURLConnection urlConnection = (HttpsURLConnection) url.openConnection();
|
|
||||||
urlConnection.setRequestMethod("GET");
|
|
||||||
urlConnection.setDoOutput(true);
|
|
||||||
|
|
||||||
final BufferedReader in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
|
|
||||||
final StringBuilder response = new StringBuilder();
|
|
||||||
String inputLine;
|
|
||||||
|
|
||||||
while ((inputLine = in.readLine()) != null) {
|
|
||||||
response.append(inputLine);
|
|
||||||
}
|
|
||||||
in.close();
|
|
||||||
System.out.println(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@DisplayName("MojangAPI - New Methods")
|
|
||||||
public void testNewMojangAPIMethods() throws IOException {
|
|
||||||
final MojangAPI mojangAPI = new MojangAPI();
|
|
||||||
final Optional<String> uuid = mojangAPI.getUUID(NAME);
|
|
||||||
Assertions.assertTrue(uuid.isPresent());
|
|
||||||
|
|
||||||
final Optional<MojangSkin> skin;
|
|
||||||
try {
|
|
||||||
skin = mojangAPI.getSkin(uuid.get());
|
|
||||||
} catch (ExecutionException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
Assertions.assertTrue(skin.isPresent());
|
|
||||||
Assertions.assertDoesNotThrow(this::testNewMojangAPIMethods);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -13,17 +13,17 @@ import java.util.Optional;
|
||||||
public class SQLStorageTest {
|
public class SQLStorageTest {
|
||||||
private static ServerMock server;
|
private static ServerMock server;
|
||||||
private static NickoBukkit plugin;
|
private static NickoBukkit plugin;
|
||||||
private static NickoConfiguration config;
|
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeAll
|
||||||
public static void setup() {
|
public static void setup() {
|
||||||
server = MockBukkit.mock();
|
final NickoConfiguration config = new NickoConfiguration(null);
|
||||||
config = new NickoConfiguration(null);
|
|
||||||
config.setLocalStorage(false);
|
config.setLocalStorage(false);
|
||||||
config.setBungeecordSupport(false);
|
config.setBungeecordSupport(false);
|
||||||
config.setSQLAddress("127.0.0.1");
|
config.setSQLAddress("127.0.0.1");
|
||||||
config.setSQLUsername("root");
|
config.setSQLUsername("root");
|
||||||
config.setSQLPassword("12345"); // https://howsecureismypassword.net/ "Your password would be cracked: Instantly"
|
config.setSQLPassword("12345"); // https://howsecureismypassword.net/ "Your password would be cracked: Instantly"
|
||||||
|
|
||||||
|
server = MockBukkit.mock();
|
||||||
plugin = MockBukkit.load(NickoBukkit.class, config);
|
plugin = MockBukkit.load(NickoBukkit.class, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue