mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-09-07 04:48:07 +02:00
Add some extra tests to ApplicableRegionSetTest.
This commit is contained in:
parent
fac6ebef40
commit
d9d665ab14
@ -35,6 +35,112 @@
|
|||||||
|
|
||||||
public class ApplicableRegionSetTest {
|
public class ApplicableRegionSetTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testWildernessBuild() {
|
||||||
|
MockApplicableRegionSet mock = new MockApplicableRegionSet();
|
||||||
|
|
||||||
|
LocalPlayer player = mock.createPlayer();
|
||||||
|
|
||||||
|
ApplicableRegionSet set = mock.getApplicableSet();
|
||||||
|
assertThat(set.testBuild(player), is(true));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testWildernessBuildWithGlobalRegion() {
|
||||||
|
MockApplicableRegionSet mock = new MockApplicableRegionSet();
|
||||||
|
|
||||||
|
LocalPlayer player = mock.createPlayer();
|
||||||
|
|
||||||
|
ProtectedRegion global = mock.global();
|
||||||
|
|
||||||
|
ApplicableRegionSet set = mock.getApplicableSet();
|
||||||
|
assertThat(set.testBuild(player), is(true));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testWildernessBuildWithRegion() {
|
||||||
|
MockApplicableRegionSet mock = new MockApplicableRegionSet();
|
||||||
|
|
||||||
|
LocalPlayer member = mock.createPlayer();
|
||||||
|
LocalPlayer nonMember = mock.createPlayer();
|
||||||
|
|
||||||
|
ProtectedRegion region = mock.add(0);
|
||||||
|
region.getMembers().addPlayer(member);
|
||||||
|
|
||||||
|
ApplicableRegionSet set = mock.getApplicableSet();
|
||||||
|
assertThat(set.testBuild(member), is(true));
|
||||||
|
assertThat(set.testBuild(nonMember), is(false));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFlags() {
|
||||||
|
MockApplicableRegionSet mock = new MockApplicableRegionSet();
|
||||||
|
|
||||||
|
LocalPlayer player = mock.createPlayer();
|
||||||
|
|
||||||
|
ApplicableRegionSet set = mock.getApplicableSet();
|
||||||
|
assertThat(set.testState(player, DefaultFlag.PVP), is(true));
|
||||||
|
assertThat(set.testState(player, DefaultFlag.MOB_DAMAGE), is(true));
|
||||||
|
assertThat(set.testState(player, DefaultFlag.MOB_DAMAGE), is(true));
|
||||||
|
assertThat(set.testState(player, DefaultFlag.ENTRY), is(true));
|
||||||
|
assertThat(set.testState(player, DefaultFlag.EXIT), is(true));
|
||||||
|
assertThat(set.testState(player, DefaultFlag.CHEST_ACCESS), is(true));
|
||||||
|
assertThat(set.testState(player, DefaultFlag.SLEEP), is(true));
|
||||||
|
assertThat(set.testState(player, DefaultFlag.TNT), is(true));
|
||||||
|
assertThat(set.testState(player, DefaultFlag.LEAF_DECAY), is(true));
|
||||||
|
assertThat(set.testState(player, DefaultFlag.RECEIVE_CHAT), is(true));
|
||||||
|
assertThat(set.testState(player, DefaultFlag.SEND_CHAT), is(true));
|
||||||
|
assertThat(set.testState(player, DefaultFlag.INVINCIBILITY), is(false));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testWildernessFlagsWithGlobalRegion() {
|
||||||
|
MockApplicableRegionSet mock = new MockApplicableRegionSet();
|
||||||
|
|
||||||
|
LocalPlayer player = mock.createPlayer();
|
||||||
|
|
||||||
|
ProtectedRegion global = mock.global();
|
||||||
|
|
||||||
|
ApplicableRegionSet set = mock.getApplicableSet();
|
||||||
|
assertThat(set.testState(player, DefaultFlag.PVP), is(true));
|
||||||
|
assertThat(set.testState(player, DefaultFlag.MOB_DAMAGE), is(true));
|
||||||
|
assertThat(set.testState(player, DefaultFlag.MOB_DAMAGE), is(true));
|
||||||
|
assertThat(set.testState(player, DefaultFlag.ENTRY), is(true));
|
||||||
|
assertThat(set.testState(player, DefaultFlag.EXIT), is(true));
|
||||||
|
assertThat(set.testState(player, DefaultFlag.CHEST_ACCESS), is(true));
|
||||||
|
assertThat(set.testState(player, DefaultFlag.SLEEP), is(true));
|
||||||
|
assertThat(set.testState(player, DefaultFlag.TNT), is(true));
|
||||||
|
assertThat(set.testState(player, DefaultFlag.LEAF_DECAY), is(true));
|
||||||
|
assertThat(set.testState(player, DefaultFlag.RECEIVE_CHAT), is(true));
|
||||||
|
assertThat(set.testState(player, DefaultFlag.SEND_CHAT), is(true));
|
||||||
|
assertThat(set.testState(player, DefaultFlag.INVINCIBILITY), is(false));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFlagsWithRegion() {
|
||||||
|
MockApplicableRegionSet mock = new MockApplicableRegionSet();
|
||||||
|
|
||||||
|
LocalPlayer member = mock.createPlayer();
|
||||||
|
LocalPlayer nonMember = mock.createPlayer();
|
||||||
|
|
||||||
|
ProtectedRegion region = mock.add(0);
|
||||||
|
region.getMembers().addPlayer(member);
|
||||||
|
|
||||||
|
ApplicableRegionSet set = mock.getApplicableSet();
|
||||||
|
assertThat(set.testState(member, DefaultFlag.ENTRY), is(true));
|
||||||
|
assertThat(set.testState(member, DefaultFlag.EXIT), is(true));
|
||||||
|
assertThat(set.testState(member, DefaultFlag.LEAF_DECAY), is(true));
|
||||||
|
assertThat(set.testState(member, DefaultFlag.RECEIVE_CHAT), is(true));
|
||||||
|
assertThat(set.testState(member, DefaultFlag.SEND_CHAT), is(true));
|
||||||
|
assertThat(set.testState(member, DefaultFlag.INVINCIBILITY), is(false));
|
||||||
|
assertThat(set.testState(nonMember, DefaultFlag.ENTRY), is(true));
|
||||||
|
assertThat(set.testState(nonMember, DefaultFlag.EXIT), is(true));
|
||||||
|
assertThat(set.testState(nonMember, DefaultFlag.LEAF_DECAY), is(true));
|
||||||
|
assertThat(set.testState(nonMember, DefaultFlag.RECEIVE_CHAT), is(true));
|
||||||
|
assertThat(set.testState(nonMember, DefaultFlag.SEND_CHAT), is(true));
|
||||||
|
assertThat(set.testState(nonMember, DefaultFlag.INVINCIBILITY), is(false));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testStateFlagPriorityFallThrough() {
|
public void testStateFlagPriorityFallThrough() {
|
||||||
MockApplicableRegionSet mock = new MockApplicableRegionSet();
|
MockApplicableRegionSet mock = new MockApplicableRegionSet();
|
||||||
|
Loading…
Reference in New Issue
Block a user