-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement tests via GitHub actions (#602)
- Loading branch information
1 parent
11fc458
commit 4032e55
Showing
5 changed files
with
89 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
hypixel-api-example/src/test/java/net/hypixel/api/example/TestAuthenticatedEndpoints.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package net.hypixel.api.example; | ||
|
||
import net.hypixel.api.reply.*; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.concurrent.ExecutionException; | ||
import java.util.concurrent.TimeUnit; | ||
import java.util.concurrent.TimeoutException; | ||
|
||
public class TestAuthenticatedEndpoints { | ||
|
||
@Test | ||
void boosters() throws ExecutionException, InterruptedException, TimeoutException { | ||
BoostersReply response = ExampleUtil.API.getBoosters().get(5, TimeUnit.SECONDS); | ||
|
||
Assertions.assertTrue(response.isSuccess()); | ||
} | ||
|
||
@Test | ||
void leaderboards() throws ExecutionException, InterruptedException, TimeoutException { | ||
LeaderboardsReply response = ExampleUtil.API.getLeaderboards().get(5, TimeUnit.SECONDS); | ||
|
||
Assertions.assertTrue(response.isSuccess()); | ||
} | ||
|
||
@Test | ||
void punishmentStats() throws ExecutionException, InterruptedException, TimeoutException { | ||
PunishmentStatsReply response = ExampleUtil.API.getPunishmentStats().get(5, TimeUnit.SECONDS); | ||
|
||
Assertions.assertTrue(response.isSuccess()); | ||
} | ||
|
||
@Test | ||
void player() throws ExecutionException, InterruptedException, TimeoutException { | ||
PlayerReply response = ExampleUtil.API.getPlayerByUuid(ExampleUtil.HYPIXEL).get(5, TimeUnit.SECONDS); | ||
|
||
Assertions.assertTrue(response.isSuccess()); | ||
Assertions.assertNotNull(response.getPlayer()); | ||
Assertions.assertNotNull(response.getPlayer().getName()); | ||
Assertions.assertNotNull(response.getPlayer().getUuid()); | ||
} | ||
|
||
@Test | ||
void guild() throws ExecutionException, InterruptedException, TimeoutException { | ||
GuildReply response = ExampleUtil.API.getGuildByPlayer(ExampleUtil.HYPIXEL).get(5, TimeUnit.SECONDS); | ||
|
||
Assertions.assertTrue(response.isSuccess()); | ||
Assertions.assertNotNull(response.getGuild()); | ||
Assertions.assertNotNull(response.getGuild().getName()); | ||
Assertions.assertNotNull(response.getGuild().getId()); | ||
} | ||
|
||
@Test | ||
void counts() throws ExecutionException, InterruptedException, TimeoutException { | ||
CountsReply response = ExampleUtil.API.getCounts().get(5, TimeUnit.SECONDS); | ||
|
||
Assertions.assertTrue(response.isSuccess()); | ||
Assertions.assertTrue(response.getPlayerCount() >= 0); | ||
Assertions.assertFalse(response.getGames().isEmpty()); | ||
} | ||
|
||
} |
1 change: 1 addition & 0 deletions
1
hypixel-api-example/src/test/resources/junit-platform.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
junit.jupiter.execution.parallel.enabled=true |