mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2025-01-09 17:57:36 +01:00
Fixed failing tests (thanks @rlf)
* This is the test fixing portion of PR#1746 * This fixes using a HashMap and relying on the order of the values.
This commit is contained in:
parent
3db57ee1d9
commit
8fdc0ad3da
@ -104,6 +104,9 @@ public class TestWorldProperties {
|
||||
verify(mockCommandSender).sendMessage("Starting import of world 'world'...");
|
||||
verify(mockCommandSender).sendMessage(ChatColor.GREEN + "Complete!");
|
||||
|
||||
assertEquals(core.getServer().getWorlds().size(), 1);
|
||||
assertEquals(core.getServer().getWorlds().get(0).getName(), "world");
|
||||
|
||||
// Import a second world
|
||||
String[] netherArgs = new String[] { "import", "world_nether", "nether" };
|
||||
core.onCommand(mockCommandSender, mockCommand, "", netherArgs);
|
||||
@ -111,6 +114,10 @@ public class TestWorldProperties {
|
||||
verify(mockCommandSender, VerificationModeFactory.times(2)).sendMessage(
|
||||
ChatColor.GREEN + "Complete!");
|
||||
|
||||
assertEquals(core.getServer().getWorlds().size(), 2);
|
||||
assertEquals(core.getServer().getWorlds().get(0).getName(), "world");
|
||||
assertEquals(core.getServer().getWorlds().get(1).getName(), "world_nether");
|
||||
|
||||
// ////////////////////////////////////////////////
|
||||
// let's set some world-properties
|
||||
// we can test the API with this, too :D
|
||||
|
@ -24,12 +24,13 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.WeakHashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
public class MockWorldFactory {
|
||||
|
||||
private static final Map<String, World> createdWorlds = new HashMap<String, World>();
|
||||
private static final Map<String, World> createdWorlds = new LinkedHashMap<String, World>();
|
||||
private static final Map<UUID, World> worldUIDS = new HashMap<UUID, World>();
|
||||
|
||||
private static final Map<World, Boolean> pvpStates = new WeakHashMap<World, Boolean>();
|
||||
@ -212,13 +213,7 @@ public class MockWorldFactory {
|
||||
}
|
||||
|
||||
public static List<World> getWorlds() {
|
||||
// we have to invert the order!
|
||||
ArrayList<World> myList = new ArrayList<World>(createdWorlds.values());
|
||||
List<World> retList = new ArrayList<World>();
|
||||
for (int i = (myList.size() - 1); i >= 0; i--) {
|
||||
retList.add(myList.get(i));
|
||||
}
|
||||
return retList;
|
||||
return new ArrayList<World>(createdWorlds.values());
|
||||
}
|
||||
|
||||
public static void clearWorlds() {
|
||||
|
Loading…
Reference in New Issue
Block a user