I'm trying to do a unit test but mocking doesn't work as I want. Here's the method to be tested: Code:java public double distance(Player player) {return player.getLocation().distance(getLocation());} And here's the test: Code:java [USER=36465]test[/USER]public void testDistance() {World world = mock(World.class); AbstractWarp warp = mock(AbstractWarp.class);Location loc = new Location(world, 0, 0, 0);when(warp.getLocation()).thenReturn(loc); Player player = mock(Player.class);Location loc2 = new Location(world, 100, 0, 0);when(player.getLocation()).thenReturn(loc2); assertEquals(100, warp.distance(player), .1);} The assertion fails: java.lang.AssertionError: expected:<100.0> but was:<0.0> I know this is rather a general question than a bukkit question but I've made good experience on here. Any ideas?
TGRHavoc Ah, thanks but that's not exactly what I wanted bump EDIT by Moderator: merged posts, please use the edit button instead of double posting.