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>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.12.4</version>
|
||||
<configuration>
|
||||
<skipTests>true</skipTests>
|
||||
</configuration>
|
||||
<version>3.0.0-M7</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
|
@ -57,6 +54,10 @@
|
|||
</plugins>
|
||||
</build>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>papermc</id>
|
||||
<url>https://repo.papermc.io/repository/maven-public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>xenondevs</id>
|
||||
<url>https://repo.xenondevs.xyz/releases</url>
|
||||
|
@ -110,25 +111,47 @@
|
|||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter</artifactId>
|
||||
<version>5.9.0</version>
|
||||
<groupId>com.github.seeseemelk</groupId>
|
||||
<artifactId>MockBukkit-v1.19</artifactId>
|
||||
<version>2.29.0</version>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<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>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>junit-jupiter-params</artifactId>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>hamcrest-library</artifactId>
|
||||
<groupId>org.hamcrest</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>adventure-platform-bungeecord</artifactId>
|
||||
<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>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mariadb.jdbc</groupId>
|
||||
<artifactId>mariadb-java-client</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
|
|
|
@ -113,10 +113,7 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.12.4</version>
|
||||
<configuration>
|
||||
<skipTests>true</skipTests>
|
||||
</configuration>
|
||||
<version>3.0.0-M7</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<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 {
|
||||
private static ServerMock server;
|
||||
private static NickoBukkit plugin;
|
||||
private static NickoConfiguration config;
|
||||
|
||||
@BeforeAll
|
||||
public static void setup() {
|
||||
server = MockBukkit.mock();
|
||||
config = new NickoConfiguration(null);
|
||||
final NickoConfiguration config = new NickoConfiguration(null);
|
||||
config.setLocalStorage(false);
|
||||
config.setBungeecordSupport(false);
|
||||
config.setSQLAddress("127.0.0.1");
|
||||
config.setSQLUsername("root");
|
||||
config.setSQLPassword("12345"); // https://howsecureismypassword.net/ "Your password would be cracked: Instantly"
|
||||
|
||||
server = MockBukkit.mock();
|
||||
plugin = MockBukkit.load(NickoBukkit.class, config);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue