Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions hypixel-api-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@
<artifactId>gson</artifactId>
<version>2.8.6</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.konghq</groupId>
<artifactId>unirest-java</artifactId>
<version>3.11.11</version>
<scope>test</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import java.util.concurrent.CompletableFuture;

public class HypixelAPI {
private static final String BASE_URL = "https://api.hypixel.net/";
static final String BASE_URL = "https://api.hypixel.net/";

private final HypixelHttpClient httpClient;

Expand Down
29 changes: 29 additions & 0 deletions hypixel-api-core/src/test/java/net/hypixel/api/TestResources.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package net.hypixel.api;

import kong.unirest.HttpResponse;
import kong.unirest.JsonNode;
import kong.unirest.Unirest;
import net.hypixel.api.util.ResourceType;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;

import java.util.stream.Stream;

public class TestResources {

static Stream<Arguments> getResourceTypes() {
return Stream.of(ResourceType.values())
.map(Arguments::of);
}

@ParameterizedTest
@MethodSource("getResourceTypes")
void testResource(ResourceType resourceType) {
String url = String.format("%sresources/%s", HypixelAPI.BASE_URL, resourceType.getPath());
HttpResponse<JsonNode> response = Unirest.get(url).asJson();
Assertions.assertEquals(200, response.getStatus(), String.format("Got an invalid status code for %s", resourceType));
}

}
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@
<linksource>true</linksource>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
</plugin>
</plugins>
</build>

Expand Down