List of usage examples for net.minecraftforge.event.entity EntityMobGriefingEvent EntityMobGriefingEvent
public EntityMobGriefingEvent(Entity entity)
From source file:com.judge40.minecraft.bettermobgriefinggamerule.common.MobGriefingEventHandlerTest.java
License:Open Source License
/** * Test that the event result is set to DEFAULT when the entity is null. *//* w w w . j ava 2s . c om*/ @Test public void testOnMobGriefing_entityNull_default() { // Set up test data. EntityMobGriefingEvent event = new EntityMobGriefingEvent(null); // Call the method under test. eventHandler.onMobGriefing(event); // Perform assertions. Assert.assertThat("The event result is not match the expected value.", event.getResult(), CoreMatchers.is(Result.DEFAULT)); }
From source file:com.judge40.minecraft.bettermobgriefinggamerule.common.MobGriefingEventHandlerTest.java
License:Open Source License
/** * Test that the event result is set to DENY when mob griefing is disabled. *///from w w w . j av a 2s. co m @Test public void testOnMobGriefing_disabled_deny(@Mocked Entity entity) { // Set up test data. EntityMobGriefingEvent event = new EntityMobGriefingEvent(entity); // Record expectations. new Expectations(BetterMobGriefingGameRule.class) { { BetterMobGriefingGameRule.isMobGriefingEnabled(entity); result = false; } }; // Call the method under test. eventHandler.onMobGriefing(event); // Perform assertions. Assert.assertThat("The event result is not match the expected value.", event.getResult(), CoreMatchers.is(Result.DENY)); }
From source file:com.judge40.minecraft.bettermobgriefinggamerule.common.MobGriefingEventHandlerTest.java
License:Open Source License
/** * Test that the event result is set to ALLOW when mob griefing is enabled. *///from ww w. j av a2 s . c o m @Test public void testOnMobGriefing_enabled_allow(@Mocked Entity entity) { // Set up test data. EntityMobGriefingEvent event = new EntityMobGriefingEvent(entity); // Record expectations. new Expectations(BetterMobGriefingGameRule.class) { { BetterMobGriefingGameRule.isMobGriefingEnabled(entity); result = true; } }; // Call the method under test. eventHandler.onMobGriefing(event); // Perform assertions. Assert.assertThat("The event result is not match the expected value.", event.getResult(), CoreMatchers.is(Result.ALLOW)); }