From f199b977eba7d30a33fb73ef2f06806d92869d5c Mon Sep 17 00:00:00 2001 From: sk89q Date: Wed, 24 Oct 2012 00:21:16 -0700 Subject: [PATCH] Added more tests for the PRTreeRegionManager to fail. --- .../protection/FlatRegionOverlapTest.java | 29 +++++++++++++++++++ .../protection/FlatRegionPriorityTest.java | 29 +++++++++++++++++++ .../protection/PRTreeRegionOverlapTest.java | 29 +++++++++++++++++++ .../protection/PRTreeRegionPriorityTest.java | 29 +++++++++++++++++++ .../protection/RegionPriorityTest.java | 6 ++-- 5 files changed, 120 insertions(+), 2 deletions(-) create mode 100644 src/test/java/com/sk89q/worldguard/protection/FlatRegionOverlapTest.java create mode 100644 src/test/java/com/sk89q/worldguard/protection/FlatRegionPriorityTest.java create mode 100644 src/test/java/com/sk89q/worldguard/protection/PRTreeRegionOverlapTest.java create mode 100644 src/test/java/com/sk89q/worldguard/protection/PRTreeRegionPriorityTest.java diff --git a/src/test/java/com/sk89q/worldguard/protection/FlatRegionOverlapTest.java b/src/test/java/com/sk89q/worldguard/protection/FlatRegionOverlapTest.java new file mode 100644 index 00000000..8500eab1 --- /dev/null +++ b/src/test/java/com/sk89q/worldguard/protection/FlatRegionOverlapTest.java @@ -0,0 +1,29 @@ +// $Id$ +/* + * WorldGuard + * Copyright (C) 2010 sk89q + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . +*/ + +package com.sk89q.worldguard.protection; + +import com.sk89q.worldguard.protection.managers.FlatRegionManager; +import com.sk89q.worldguard.protection.managers.RegionManager; + +public class FlatRegionOverlapTest extends RegionOverlapTest { + protected RegionManager createRegionManager() throws Exception { + return new FlatRegionManager(null); + } +} diff --git a/src/test/java/com/sk89q/worldguard/protection/FlatRegionPriorityTest.java b/src/test/java/com/sk89q/worldguard/protection/FlatRegionPriorityTest.java new file mode 100644 index 00000000..2fd1941f --- /dev/null +++ b/src/test/java/com/sk89q/worldguard/protection/FlatRegionPriorityTest.java @@ -0,0 +1,29 @@ +// $Id$ +/* + * WorldGuard + * Copyright (C) 2010 sk89q + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . +*/ + +package com.sk89q.worldguard.protection; + +import com.sk89q.worldguard.protection.managers.FlatRegionManager; +import com.sk89q.worldguard.protection.managers.RegionManager; + +public class FlatRegionPriorityTest extends RegionPriorityTest { + protected RegionManager createRegionManager() throws Exception { + return new FlatRegionManager(null); + } +} diff --git a/src/test/java/com/sk89q/worldguard/protection/PRTreeRegionOverlapTest.java b/src/test/java/com/sk89q/worldguard/protection/PRTreeRegionOverlapTest.java new file mode 100644 index 00000000..80c4c6fc --- /dev/null +++ b/src/test/java/com/sk89q/worldguard/protection/PRTreeRegionOverlapTest.java @@ -0,0 +1,29 @@ +// $Id$ +/* + * WorldGuard + * Copyright (C) 2010 sk89q + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . +*/ + +package com.sk89q.worldguard.protection; + +import com.sk89q.worldguard.protection.managers.PRTreeRegionManager; +import com.sk89q.worldguard.protection.managers.RegionManager; + +public class PRTreeRegionOverlapTest extends RegionOverlapTest { + protected RegionManager createRegionManager() throws Exception { + return new PRTreeRegionManager(null); + } +} diff --git a/src/test/java/com/sk89q/worldguard/protection/PRTreeRegionPriorityTest.java b/src/test/java/com/sk89q/worldguard/protection/PRTreeRegionPriorityTest.java new file mode 100644 index 00000000..73202a5a --- /dev/null +++ b/src/test/java/com/sk89q/worldguard/protection/PRTreeRegionPriorityTest.java @@ -0,0 +1,29 @@ +// $Id$ +/* + * WorldGuard + * Copyright (C) 2010 sk89q + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . +*/ + +package com.sk89q.worldguard.protection; + +import com.sk89q.worldguard.protection.managers.PRTreeRegionManager; +import com.sk89q.worldguard.protection.managers.RegionManager; + +public class PRTreeRegionPriorityTest extends RegionPriorityTest { + protected RegionManager createRegionManager() throws Exception { + return new PRTreeRegionManager(null); + } +} diff --git a/src/test/java/com/sk89q/worldguard/protection/RegionPriorityTest.java b/src/test/java/com/sk89q/worldguard/protection/RegionPriorityTest.java index 93d89a85..7be2eb5c 100644 --- a/src/test/java/com/sk89q/worldguard/protection/RegionPriorityTest.java +++ b/src/test/java/com/sk89q/worldguard/protection/RegionPriorityTest.java @@ -34,7 +34,7 @@ import org.junit.Test; import static org.junit.Assert.*; -public class RegionPriorityTest { +public abstract class RegionPriorityTest { static String COURTYARD_ID = "courtyard"; static String FOUNTAIN_ID = "fountain"; static String NO_FIRE_ID = "nofire"; @@ -50,12 +50,14 @@ public class RegionPriorityTest { ProtectedRegion fountain; TestPlayer player1; TestPlayer player2; + + protected abstract RegionManager createRegionManager() throws Exception; @Before public void setUp() throws Exception { setUpGlobalRegion(); - manager = new FlatRegionManager(null); + manager = createRegionManager(); setUpPlayers(); setUpCourtyardRegion();