This commit is contained in:
okx-code
2020-07-17 15:16:23 +01:00
parent 55e190a5c2
commit e043cd2b1f
6 changed files with 890 additions and 826 deletions
@@ -0,0 +1,35 @@
package sh.okx.rankup;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import be.seeseemelk.mockbukkit.entity.PlayerMock;
import org.junit.Test;
public class RankupCommandTest extends RankupTest {
@Test
public void testPlaceholders() {
// placeholders command should never throw an exception
PlayerMock player = server.addPlayer();
player.addAttachment(plugin, "rankup.admin", true);
plugin.getCommand("rankup3").execute(player, "pru", new String[] {"placeholders"});
player.assertSaid("--- Rankup placeholders ---");
}
@Test
public void testForce() {
// forcing rankup should change group and not affect money
PlayerMock player = server.addPlayer();
player.addAttachment(plugin, "rankup.force", true);
plugin.getEconomy().setPlayer(player, 11);
groupProvider.addGroup(player.getUniqueId(), "A");
plugin.getCommand("rankup3").execute(player, "pru", new String[] {"forcerankup", player.getName()});
assertTrue(groupProvider.inGroup(player.getUniqueId(), "B"));
assertEquals(11, plugin.getEconomy().getBalance(player), 0.0001);
}
}