Search in sources :

Example 1 with BukkitMCWorld

use of com.laytonsmith.abstraction.bukkit.BukkitMCWorld in project CommandHelper by EngineHub.

the class PlayerManangementTest method testPloc.

// @Test(timeout = 10000)
// public void testAllPlayers() throws Exception {
// String script = "all_players()";
// String done = SRun(script, fakePlayer);
// //This output is too long to test with msg()
// assertEquals("{player1, player2, player3, player}", done);
// }
@Test
public void testPloc() throws Exception, Exception {
    String script = "msg(ploc())";
    BukkitMCWorld w = GetWorld("world");
    MCLocation loc = StaticLayer.GetLocation(w, 0, 1, 0);
    when(fakePlayer.getLocation()).thenReturn(loc);
    when(fakePlayer.getWorld()).thenReturn(w);
    SRun(script, fakePlayer);
    verify(fakePlayer).sendMessage("{0: 0.0, 1: 1.0, 2: 0.0, 3: world, 4: 0.0, 5: 0.0, pitch: 0.0, world: world, x: 0.0, y: 1.0, yaw: 0.0, z: 0.0}");
}
Also used : MCLocation(com.laytonsmith.abstraction.MCLocation) BukkitMCWorld(com.laytonsmith.abstraction.bukkit.BukkitMCWorld) Test(org.junit.Test) StaticTest(com.laytonsmith.testing.StaticTest)

Example 2 with BukkitMCWorld

use of com.laytonsmith.abstraction.bukkit.BukkitMCWorld in project CommandHelper by EngineHub.

the class StaticTest method GetWorld.

public static BukkitMCWorld GetWorld(String name) {
    BukkitMCWorld w = mock(BukkitMCWorld.class);
    when(w.getName()).thenReturn(name);
    return w;
}
Also used : BukkitMCWorld(com.laytonsmith.abstraction.bukkit.BukkitMCWorld)

Aggregations

BukkitMCWorld (com.laytonsmith.abstraction.bukkit.BukkitMCWorld)2 MCLocation (com.laytonsmith.abstraction.MCLocation)1 StaticTest (com.laytonsmith.testing.StaticTest)1 Test (org.junit.Test)1