Skip to content

Commit 1d93818

Browse files
committed
test(player): add player test base
1 parent 0bc02bd commit 1d93818

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package net.onelitefeather.cygnus;
2+
3+
import net.minestom.server.entity.Player;
4+
import net.minestom.server.network.PlayerProvider;
5+
import net.minestom.testing.Env;
6+
import net.minestom.testing.extension.MicrotusExtension;
7+
import net.onelitefeather.cygnus.player.CygnusPlayer;
8+
import org.junit.jupiter.api.BeforeAll;
9+
import org.junit.jupiter.api.extension.ExtendWith;
10+
11+
/**
12+
* The class is a small utility class which overwrites the given {@link PlayerProvider} from the test environment to use the {@link CygnusPlayer} instead of the default {@link Player}.
13+
* This allows us to test the stamina system and other player related features without having to create a new player provider for each test class.
14+
* @author Joltra
15+
* @version 1.0.0
16+
* @since 2.3.0
17+
*/
18+
@ExtendWith(MicrotusExtension.class)
19+
public abstract class CygnusPlayerTestBase {
20+
21+
@BeforeAll
22+
static void init(Env env) {
23+
env.process().connection().setPlayerProvider(CygnusPlayer::new);
24+
}
25+
}

0 commit comments

Comments
 (0)