blob: 44cec5a974220d4232101102a2a16877c5cea1d5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
import com.leonardobishop.quests.Quests;
import com.leonardobishop.quests.events.EventPlayerJoin;
import junit.framework.TestCase;
import org.bukkit.Bukkit;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPluginLoader;
import java.util.UUID;
public class TestPlayerJoin extends TestCase {
private Quests quests;
@Override
public void setUp() throws Exception {
FakeServer fakeServer = new FakeServer();
Bukkit.setServer(fakeServer);
PluginDescriptionFile pluginDescriptionFile =
new PluginDescriptionFile("Quests", "TEST", "com.leonardobishop.quests.Quests");
quests = new Quests(new JavaPluginLoader(fakeServer), pluginDescriptionFile, null, null);
quests.prepareForTest();
}
public void testJoin() {
FakePlayer player = new FakePlayer("bob", new UUID(0L, 0L));
PlayerJoinEvent joinEvent = new FakePlayerJoinEvent(player, "bob joined");
EventPlayerJoin eventToTest = new EventPlayerJoin();
eventToTest.onEvent(joinEvent);
assertNotNull(quests.getPlayerManager().getPlayer(player.getUniqueId()));
}
}
|