How to use FrogMock class of be.seeseemelk.mockbukkit.entity package

Best MockBukkit code snippet using be.seeseemelk.mockbukkit.entity.FrogMock

Source:WorldMockTest.java Github

copy

Full Screen

...19import be.seeseemelk.mockbukkit.entity.EndermanMock;20import be.seeseemelk.mockbukkit.entity.ExperienceOrbMock;21import be.seeseemelk.mockbukkit.entity.FireworkMock;22import be.seeseemelk.mockbukkit.entity.FoxMock;23import be.seeseemelk.mockbukkit.entity.FrogMock;24import be.seeseemelk.mockbukkit.entity.GiantMock;25import be.seeseemelk.mockbukkit.entity.GhastMock;26import be.seeseemelk.mockbukkit.entity.GoatMock;27import be.seeseemelk.mockbukkit.entity.ItemEntityMock;28import be.seeseemelk.mockbukkit.entity.LlamaMock;29import be.seeseemelk.mockbukkit.entity.MuleMock;30import be.seeseemelk.mockbukkit.entity.MushroomCowMock;31import be.seeseemelk.mockbukkit.entity.PigMock;32import be.seeseemelk.mockbukkit.entity.PufferFishMock;33import be.seeseemelk.mockbukkit.entity.SalmonMock;34import be.seeseemelk.mockbukkit.entity.SheepMock;35import be.seeseemelk.mockbukkit.entity.SkeletonHorseMock;36import be.seeseemelk.mockbukkit.entity.SkeletonMock;37import be.seeseemelk.mockbukkit.entity.SpiderMock;38import be.seeseemelk.mockbukkit.entity.StrayMock;39import be.seeseemelk.mockbukkit.entity.TadpoleMock;40import be.seeseemelk.mockbukkit.entity.TropicalFishMock;41import be.seeseemelk.mockbukkit.entity.WardenMock;42import be.seeseemelk.mockbukkit.entity.WitherSkeletonMock;43import be.seeseemelk.mockbukkit.entity.WolfMock;44import be.seeseemelk.mockbukkit.entity.ZombieHorseMock;45import be.seeseemelk.mockbukkit.entity.ZombieMock;46import com.google.common.io.ByteArrayDataOutput;47import com.google.common.io.ByteStreams;48import org.bukkit.Chunk;49import org.bukkit.Difficulty;50import org.bukkit.Effect;51import org.bukkit.GameRule;52import org.bukkit.Location;53import org.bukkit.Material;54import org.bukkit.World;55import org.bukkit.block.Biome;56import org.bukkit.block.Block;57import org.bukkit.block.data.BlockData;58import org.bukkit.entity.Entity;59import org.bukkit.entity.EntityType;60import org.bukkit.entity.Horse;61import org.bukkit.entity.Item;62import org.bukkit.entity.LivingEntity;63import org.bukkit.entity.Player;64import org.bukkit.entity.Sheep;65import org.bukkit.entity.Zombie;66import org.bukkit.event.entity.CreatureSpawnEvent;67import org.bukkit.event.entity.ItemSpawnEvent;68import org.bukkit.event.entity.ProjectileLaunchEvent;69import org.bukkit.event.weather.ThunderChangeEvent;70import org.bukkit.event.weather.WeatherChangeEvent;71import org.bukkit.event.world.TimeSkipEvent;72import org.bukkit.inventory.ItemStack;73import org.junit.jupiter.api.AfterEach;74import org.junit.jupiter.api.BeforeEach;75import org.junit.jupiter.api.Test;76import java.util.List;77import static org.junit.jupiter.api.Assertions.assertEquals;78import static org.junit.jupiter.api.Assertions.assertFalse;79import static org.junit.jupiter.api.Assertions.assertInstanceOf;80import static org.junit.jupiter.api.Assertions.assertNotEquals;81import static org.junit.jupiter.api.Assertions.assertNotNull;82import static org.junit.jupiter.api.Assertions.assertSame;83import static org.junit.jupiter.api.Assertions.assertThrows;84import static org.junit.jupiter.api.Assertions.assertThrowsExactly;85import static org.junit.jupiter.api.Assertions.assertTrue;86class WorldMockTest87{88 private ServerMock server;89 @BeforeEach90 void setUp()91 {92 server = MockBukkit.mock();93 }94 @AfterEach95 void tearDown()96 {97 MockBukkit.unmock();98 }99 @Test100 void getBlockAt_StandardWorld_DefaultBlocks()101 {102 WorldMock world = new WorldMock(Material.DIRT, 3);103 assertEquals(Material.BEDROCK, world.getBlockAt(0, 0, 0).getType());104 assertEquals(Material.DIRT, world.getBlockAt(0, 1, 0).getType());105 assertEquals(Material.DIRT, world.getBlockAt(0, 2, 0).getType());106 assertEquals(Material.DIRT, world.getBlockAt(0, 3, 0).getType());107 assertEquals(Material.AIR, world.getBlockAt(0, 4, 0).getType());108 }109 @Test110 void getBlockAt_BlockChanged_BlockChanged()111 {112 WorldMock world = new WorldMock();113 assertEquals(Material.AIR, world.getBlockAt(0, 10, 0).getType());114 world.getBlockAt(0, 10, 0).setType(Material.BIRCH_WOOD);115 assertEquals(Material.BIRCH_WOOD, world.getBlockAt(0, 10, 0).getType());116 }117 @Test118 void getBlockAt_AnyBlock_LocationSet()119 {120 WorldMock world = new WorldMock();121 BlockMock block = world.getBlockAt(1, 2, 3);122 Location location = block.getLocation();123 assertEquals(1, location.getBlockX());124 assertEquals(2, location.getBlockY());125 assertEquals(3, location.getBlockZ());126 assertEquals(world, block.getWorld());127 }128 @Test129 void getSpawnLocation_Default_JustAboveDirt()130 {131 WorldMock world = new WorldMock();132 Location spawn = world.getSpawnLocation();133 assertNotNull(spawn);134 assertEquals(Material.AIR, world.getBlockAt(spawn.getBlockX(), spawn.getBlockY(), spawn.getBlockZ()).getType());135 assertEquals(Material.GRASS, world.getBlockAt(spawn.getBlockX(), spawn.getBlockY() - 1, spawn.getBlockZ()).getType());136 }137 @Test138 void setSpawnLocation_SomeNewLocation_LocationChanged()139 {140 WorldMock world = new WorldMock();141 Location spawn = world.getSpawnLocation().clone();142 world.setSpawnLocation(spawn.getBlockX() + 10, spawn.getBlockY() + 10, spawn.getBlockZ() + 10);143 assertEquals(spawn.getBlockX() + 10, world.getSpawnLocation().getBlockX());144 assertEquals(spawn.getBlockY() + 10, world.getSpawnLocation().getBlockY());145 assertEquals(spawn.getBlockZ() + 10, world.getSpawnLocation().getBlockZ());146 world.setSpawnLocation(spawn);147 assertEquals(spawn.getBlockX(), world.getSpawnLocation().getBlockX());148 assertEquals(spawn.getBlockY(), world.getSpawnLocation().getBlockY());149 assertEquals(spawn.getBlockZ(), world.getSpawnLocation().getBlockZ());150 }151 @Test152 void getEntities_NoEntities_EmptyList()153 {154 WorldMock world = new WorldMock();155 List<Entity> entities = world.getEntities();156 assertNotNull(entities);157 assertEquals(0, entities.size());158 }159 @Test160 void getEntities_OnePlayerInWorld_ListContainsOnlyPlayer()161 {162 World world = server.addSimpleWorld("world");163 server.addSimpleWorld("otherWorld");164 Player player = server.addPlayer();165 player.teleport(world.getSpawnLocation());166 List<Entity> entities = world.getEntities();167 assertNotNull(entities);168 assertEquals(1, entities.size());169 assertSame(player, entities.get(0));170 }171 @Test172 void getEntities_OnePlayerInDifferentWorld_EmptyList()173 {174 World world = server.addSimpleWorld("world");175 World otherWorld = server.addSimpleWorld("otherWorld");176 Player player = server.addPlayer();177 player.teleport(otherWorld.getSpawnLocation());178 List<Entity> entities = world.getEntities();179 assertNotNull(entities);180 assertEquals(0, entities.size());181 }182 @Test183 void getLivingEntities()184 {185 WorldMock world = new WorldMock();186 world.spawnEntity(new Location(world, 0, 0, 0), EntityType.ZOMBIE);187 world.dropItem(new Location(world, 0, 0, 0), new ItemStack(Material.STONE));188 assertEquals(2, world.getEntities().size());189 assertEquals(1, world.getLivingEntities().size());190 }191 @Test192 void getLivingEntities_EmptyList()193 {194 WorldMock world = new WorldMock();195 List<LivingEntity> entities = world.getLivingEntities();196 assertNotNull(entities);197 assertEquals(0, entities.size());198 }199 @Test200 void getEntitiesByClass()201 {202 WorldMock world = new WorldMock();203 world.spawnEntity(new Location(world, 0, 0, 0), EntityType.ZOMBIE);204 world.dropItem(new Location(world, 0, 0, 0), new ItemStack(Material.STONE));205 assertEquals(1, world.getEntitiesByClass(ZombieMock.class).size());206 assertEquals(1, world.getEntitiesByClass(ItemEntityMock.class).size());207 }208 @Test209 void getEntitiesByClasses()210 {211 WorldMock world = new WorldMock();212 world.spawnEntity(new Location(world, 0, 0, 0), EntityType.ZOMBIE);213 world.dropItem(new Location(world, 0, 0, 0), new ItemStack(Material.STONE));214 assertEquals(1, world.getEntitiesByClasses(ZombieMock.class).size());215 assertEquals(1, world.getEntitiesByClasses(ItemEntityMock.class).size());216 assertEquals(2, world.getEntitiesByClasses(ZombieMock.class, ItemEntityMock.class).size());217 }218 @Test219 @SuppressWarnings("unchecked")220 void getEntitiesByClasses_Generic()221 {222 WorldMock world = new WorldMock();223 world.spawnEntity(new Location(world, 0, 0, 0), EntityType.ZOMBIE);224 world.dropItem(new Location(world, 0, 0, 0), new ItemStack(Material.STONE));225 assertEquals(1, world.getEntitiesByClass(new Class[]{ ZombieMock.class }).size());226 assertEquals(1, world.getEntitiesByClass(new Class[]{ ItemEntityMock.class }).size());227 assertEquals(2, world.getEntitiesByClass(new Class[]{ ZombieMock.class, ItemEntityMock.class }).size());228 }229 @Test230 void getChunkAt_DifferentLocations_DifferentChunks()231 {232 WorldMock world = server.addSimpleWorld("world");233 ChunkMock chunk1 = world.getChunkAt(0, 0);234 ChunkMock chunk2 = world.getChunkAt(1, 0);235 assertNotEquals(chunk1, chunk2);236 }237 @Test238 void getChunkAt_SameLocations_EqualsChunks()239 {240 WorldMock world = server.addSimpleWorld("world");241 ChunkMock chunk1 = world.getChunkAt(0, 0);242 ChunkMock chunk2 = world.getChunkAt(0, 0);243 assertEquals(chunk1, chunk2);244 }245 @Test246 void getName_NameSet_NameExactly()247 {248 WorldMock world = new WorldMock();249 world.setName("world name");250 assertEquals("world name", world.getName());251 }252 @Test253 void setGameRule_CorrectValue_GameRuleSet()254 {255 WorldMock world = new WorldMock();256 assertTrue(world.setGameRule(GameRule.DO_DAYLIGHT_CYCLE, true));257 assertTrue(world.getGameRuleValue(GameRule.DO_DAYLIGHT_CYCLE));258 assertTrue(world.setGameRule(GameRule.DO_DAYLIGHT_CYCLE, false));259 assertFalse(world.getGameRuleValue(GameRule.DO_DAYLIGHT_CYCLE));260 }261 @Test262 void spawnZombieTest()263 {264 WorldMock world = new WorldMock();265 Location location = new Location(world, 100, 20, 50);266 Entity zombie = world.spawnEntity(location, EntityType.ZOMBIE);267 assertEquals(100, zombie.getLocation().getBlockX());268 assertEquals(20, zombie.getLocation().getBlockY());269 assertEquals(50, zombie.getLocation().getBlockZ());270 assertTrue(world.getEntities().size() > 0);271 }272 @Test273 void spawnHorseTest()274 {275 WorldMock world = new WorldMock();276 Location location = new Location(world, 100, 20, 50);277 Entity horse = world.spawnEntity(location, EntityType.HORSE);278 assertTrue(world.getEntities().size() > 0);279 assertInstanceOf(Horse.class, horse);280 }281 @Test282 void onCreated_WeatherDurationSetToZero()283 {284 WorldMock world = new WorldMock();285 assertEquals(0, world.getWeatherDuration(), "Weather duration should be zero");286 }287 @Test288 void setWeatherDuration_AnyPositiveValue_WeatherDurationSet()289 {290 WorldMock world = new WorldMock();291 int duration = 5;292 world.setWeatherDuration(duration);293 assertEquals(duration, world.getWeatherDuration(), "Weather duration should be set");294 }295 @Test296 void onCreated_NotStorming()297 {298 WorldMock world = new WorldMock();299 assertFalse(world.hasStorm(), "The world should not be storming");300 }301 @Test302 void setStorm_True_Storming()303 {304 WorldMock world = new WorldMock();305 assertFalse(world.hasStorm());306 world.setStorm(true);307 assertTrue(world.hasStorm(), "The world should be storming");308 }309 @Test310 void onCreated_ThunderDurationSetToZero()311 {312 WorldMock world = new WorldMock();313 assertEquals(0, world.getThunderDuration(), "Weather duration should be zero");314 assertFalse(world.isThundering());315 }316 @Test317 void setThunderDuration_AnyPositiveValue_ShouldBeThundering()318 {319 WorldMock world = new WorldMock();320 int duration = 20;321 world.setThunderDuration(duration);322 assertEquals(duration, world.getThunderDuration(), "Weather duration should be more than zero");323 assertFalse(world.isThundering());324 }325 @Test326 void setThundering_True_ThunderDurationShouldBePositive()327 {328 WorldMock world = new WorldMock();329 world.setThundering(true);330 assertEquals(0, world.getThunderDuration(), "Weather duration should be reset to zero");331 assertTrue(world.isThundering());332 }333 @Test334 void onCreated_TimeSetToBeZero()335 {336 WorldMock world = new WorldMock();337 assertEquals(0L, world.getFullTime(), "World time should be zero");338 assertEquals(0L, world.getTime(), "Day time should be zero");339 }340 @Test341 void setTime_DayTimeValue()342 {343 WorldMock world = new WorldMock();344 world.setTime(20L);345 assertEquals(20L, world.getTime());346 assertEquals(20L, world.getFullTime());347 }348 @Test349 void setTime_FullTimeValue()350 {351 WorldMock world = new WorldMock();352 world.setFullTime(3L * 24000L + 20L);353 assertEquals(20L, world.getTime());354 assertEquals(3L * 24000L + 20L, world.getFullTime());355 }356 @Test357 void setTime_FullTimeShouldBeAdjustedWithDayTime()358 {359 WorldMock world = new WorldMock();360 world.setFullTime(3L * 24000L + 20L);361 world.setTime(12000L);362 assertEquals(12000L, world.getTime());363 assertEquals(3L * 24000L + 12000L, world.getFullTime());364 }365 @Test366 void setTime_Event_Triggered()367 {368 WorldMock world = new WorldMock();369 world.setTime(6000L);370 world.setTime(10000L);371 server.getPluginManager().assertEventFired(TimeSkipEvent.class, event ->372 event.getSkipAmount() == 4000L && event.getSkipReason() == TimeSkipEvent.SkipReason.CUSTOM);373 }374 @Test375 void onCreated_EnvironmentSetToBeNormal()376 {377 WorldMock world = new WorldMock();378 assertEquals(World.Environment.NORMAL, world.getEnvironment(), "World environment type should be normal");379 }380 @Test381 void getLoadedChunks_EmptyWorldHasNoLoadedChunks()382 {383 WorldMock world = new WorldMock();384 assertEquals(0, world.getLoadedChunks().length);385 }386 @Test387 void isChunkLoaded_IsFalseForUnloadedChunk()388 {389 WorldMock world = new WorldMock();390 assertFalse(world.isChunkLoaded(0, 0));391 }392 @Test393 void isChunkloaded_IsTrueForLoadedChunk()394 {395 WorldMock world = new WorldMock();396 BlockMock block = world.getBlockAt(64, 64, 64);397 assertNotNull(block.getChunk());398 Chunk chunk = block.getChunk();399 assertTrue(world.isChunkLoaded(chunk.getX(), chunk.getZ()));400 }401 @Test402 void getWorldBorder_NotNull()403 {404 WorldMock worldMock = new WorldMock();405 assertNotNull(worldMock.getWorldBorder());406 }407 @Test408 void getBlockState_ChangeBlock()409 {410 WorldMock world = new WorldMock(Material.DIRT, 3);411 assertEquals(Material.DIRT, world.getType(0, 1, 0));412 Location location = new Location(world, 0, 1, 0);413 Block block = world.getBlockAt(0, 1, 0);414 BlockMock block2 = new BlockMock();415 block2.setBlockData(block.getBlockData());416 BlockStateMock state = BlockStateMock.mockState(block);417 block2.setState(state);418 assertEquals(block2.getState().getType(), world.getBlockState(0, 1, 0).getType());419 assertEquals(block2.getState().getType(), world.getBlockState(location).getType());420 }421 @Test422 void setBlock_ChangeBlock()423 {424 WorldMock world = new WorldMock(Material.DIRT, 3);425 Location location = new Location(world, 0, 1, 0);426 Block block = world.getBlockAt(0, 1, 0);427 BlockData data = block.getBlockData();428 assertEquals(data.getMaterial(), world.getBlockData(location).getMaterial());429 BlockDataMock mock = new BlockDataMock(Material.GRASS);430 BlockDataMock mock2 = new BlockDataMock(Material.GRASS_BLOCK);431 world.setBlockData(location, mock);432 assertEquals(Material.GRASS, world.getBlockData(location).getMaterial());433 assertEquals(Material.GRASS, world.getBlockData(0, 1, 0).getMaterial());434 assertEquals(Material.GRASS, world.getType(0, 1, 0));435 world.setBlockData(0, 1, 0, mock2);436 assertEquals(Material.GRASS_BLOCK, world.getBlockData(location).getMaterial());437 assertEquals(Material.GRASS_BLOCK, world.getType(location));438 world.setType(location, Material.BEDROCK);439 assertEquals(Material.BEDROCK, world.getType(location));440 world.setType(0, 1, 0, Material.DIRT);441 assertEquals(Material.DIRT, world.getType(location));442 }443 @Test444 void getDefaultBiome()445 {446 WorldMock world = new WorldMock(Material.GRASS_BLOCK, Biome.JUNGLE, 0, 256);447 Biome biome = world.getBiome(0, 0, 0);448 assertNotNull(biome);449 assertEquals(Biome.JUNGLE, biome);450 }451 @Test452 void getBiomeLegacy()453 {454 WorldMock world = new WorldMock(Material.GRASS_BLOCK, Biome.JUNGLE, 0, 256);455 Biome biome3d = world.getBiome(0, 0, 0);456 Biome biome2d = world.getBiome(0, 0);457 assertNotNull(biome3d);458 assertNotNull(biome2d);459 assertEquals(biome3d, biome2d);460 }461 @Test462 void setBiome()463 {464 WorldMock world = new WorldMock(Material.GRASS_BLOCK, Biome.JUNGLE, 0, 256);465 world.setBiome(0, 0, 0, Biome.DESERT);466 Biome biome = world.getBiome(0, 0, 0);467 assertEquals(Biome.DESERT, biome);468 }469 @Test470 void setBiome_CustomFails()471 {472 WorldMock world = new WorldMock(Material.GRASS_BLOCK, Biome.JUNGLE, 0, 256);473 assertThrows(IllegalArgumentException.class, () ->474 {475 world.setBiome(0, 0, 0, Biome.CUSTOM);476 });477 }478 @Test479 void worldPlayEffect()480 {481 WorldMock world = new WorldMock(Material.DIRT, 3);482 world.playEffect(new Location(world, 0, 0, 0), Effect.STEP_SOUND, Material.STONE);483 }484 @Test485 void testDropItem()486 {487 WorldMock world = new WorldMock(Material.DIRT, 3);488 ItemStack item = new ItemStack(Material.DIAMOND);489 Location location = new Location(world, 100, 100, 100);490 Item entity = world.dropItem(location, item);491 // Is this the same Item we wanted to drop?492 assertEquals(item, entity.getItemStack());493 // Does our Item exist in the correct World?494 assertTrue(world.getEntities().contains(entity));495 // Is it at the right location?496 assertEquals(location, entity.getLocation());497 }498 @Test499 void testDropItemNaturally()500 {501 WorldMock world = new WorldMock(Material.DIRT, 3);502 ItemStack item = new ItemStack(Material.EMERALD);503 Location location = new Location(world, 200, 100, 200);504 Item entity = world.dropItemNaturally(location, item);505 // Is this the same Item we wanted to drop?506 assertEquals(item, entity.getItemStack());507 // Does our Item exist in the correct World?508 assertTrue(world.getEntities().contains(entity));509 // Has the Location been slightly nudged?510 assertNotEquals(location, entity.getLocation());511 }512 @Test513 void testDropItemConsumer()514 {515 WorldMock world = new WorldMock(Material.DIRT, 3);516 ItemStack item = new ItemStack(Material.BEACON);517 Location location = new Location(world, 200, 50, 500);518 Item entity = world.dropItem(location, item, n ->519 {520 // This consumer should be invoked BEFORE the actually spawned.521 assertFalse(world.getEntities().contains(n));522 });523 assertEquals(item, entity.getItemStack());524 assertTrue(world.getEntities().contains(entity));525 }526 @Test527 void drop_Item_CorrectEvent()528 {529 WorldMock world = new WorldMock();530 world.dropItem(new Location(world, 0, 5, 0), new ItemStack(Material.STONE));531 server.getPluginManager().assertEventFired(ItemSpawnEvent.class, (e) -> !e.isCancelled());532 }533 @Test534 void spawn_NullLocation_ThrowsException()535 {536 WorldMock world = new WorldMock();537 assertThrowsExactly(IllegalArgumentException.class, () -> world.spawn(null, Zombie.class));538 }539 @Test540 void spawn_NullClass_ThrowsException()541 {542 WorldMock world = new WorldMock();543 assertThrowsExactly(IllegalArgumentException.class, () -> world.spawn(new Location(world, 0, 5, 0), null));544 }545 @Test546 void worldPlayEffect_NullData()547 {548 WorldMock world = new WorldMock(Material.DIRT, 3);549 Location loc = new Location(world, 0, 0, 0);550 assertThrows(IllegalArgumentException.class, () ->551 {552 world.playEffect(loc, Effect.STEP_SOUND, null);553 });554 }555 @Test556 void worldPlayEffect_IncorrectData()557 {558 WorldMock world = new WorldMock(Material.DIRT, 3);559 Location loc = new Location(world, 0, 0, 0);560 assertThrows(IllegalArgumentException.class, () ->561 {562 world.playEffect(loc, Effect.STEP_SOUND, 1.0f);563 });564 }565 @Test566 @SuppressWarnings("UnstableApiUsage")567 void testSendPluginMessage()568 {569 WorldMock world = new WorldMock(Material.DIRT, 3);570 MockPlugin plugin = MockBukkit.createMockPlugin();571 server.getMessenger().registerOutgoingPluginChannel(plugin, "BungeeCord");572 ByteArrayDataOutput out = ByteStreams.newDataOutput();573 out.writeUTF("Forward");574 out.writeUTF("ALL");575 out.writeUTF("MockBukkit");576 world.sendPluginMessage(plugin, "BungeeCord", out.toByteArray());577 }578 @Test579 void onCreated_WeatherDurations_Zero()580 {581 WorldMock world = new WorldMock();582 assertEquals(0, world.getWeatherDuration());583 assertEquals(0, world.getThunderDuration());584 assertEquals(0, world.getClearWeatherDuration());585 }586 @Test587 void onCreated_Weather()588 {589 WorldMock world = new WorldMock();590 assertTrue(world.isClearWeather());591 assertFalse(world.isThundering());592 assertFalse(world.hasStorm());593 }594 @Test595 void setStorm_ChangeState_CallsEvent()596 {597 WorldMock world = new WorldMock();598 world.setStorm(true);599 server.getPluginManager().assertEventFired(WeatherChangeEvent.class, event ->600 event.getWorld().equals(world) && event.toWeatherState());601 world.setStorm(false);602 server.getPluginManager().assertEventFired(WeatherChangeEvent.class, event ->603 event.getWorld().equals(world) && !event.toWeatherState());604 }605 @Test606 void setStorm_SameState_DoesntCallEvent()607 {608 WorldMock world = new WorldMock();609 world.setStorm(false);610 server.getPluginManager().assertEventNotFired(WeatherChangeEvent.class);611 }612 @Test613 void setStorm_SetsStorming()614 {615 WorldMock world = new WorldMock();616 world.setStorm(true);617 assertTrue(world.hasStorm());618 }619 @Test620 void setStorm_ResetsWeatherDuration()621 {622 WorldMock world = new WorldMock();623 world.setStorm(true);624 assertEquals(0, world.getWeatherDuration());625 }626 @Test627 void setStorm_ResetsClearWeatherDuration()628 {629 WorldMock world = new WorldMock();630 world.setStorm(true);631 assertEquals(0, world.getClearWeatherDuration());632 }633 @Test634 void setWeatherDuration_SetsDuration()635 {636 WorldMock world = new WorldMock();637 world.setWeatherDuration(10);638 assertEquals(10, world.getWeatherDuration());639 }640 @Test641 void setThundering_ChangeState_CallsEvent()642 {643 WorldMock world = new WorldMock();644 world.setThundering(true);645 server.getPluginManager().assertEventFired(ThunderChangeEvent.class, event ->646 event.getWorld().equals(world) && event.toThunderState());647 world.setThundering(false);648 server.getPluginManager().assertEventFired(ThunderChangeEvent.class, event ->649 event.getWorld().equals(world) && !event.toThunderState());650 }651 @Test652 void setThundering_SameState_DoesntCallEvent()653 {654 WorldMock world = new WorldMock();655 world.setThundering(false);656 server.getPluginManager().assertEventNotFired(ThunderChangeEvent.class);657 }658 @Test659 void setThundering_SetsThundering()660 {661 WorldMock world = new WorldMock();662 world.setThundering(true);663 assertTrue(world.isThundering());664 }665 @Test666 void setThundering_ResetsThunderingDuration()667 {668 WorldMock world = new WorldMock();669 world.setThundering(true);670 assertEquals(0, world.getThunderDuration());671 }672 @Test673 void setThundering_ResetsClearWeatherDuration()674 {675 WorldMock world = new WorldMock();676 world.setThundering(true);677 assertEquals(0, world.getClearWeatherDuration());678 }679 @Test680 void setThunderDuration_SetsDuration()681 {682 WorldMock world = new WorldMock();683 world.setThunderDuration(10);684 assertEquals(10, world.getThunderDuration());685 }686 @Test687 void isClearWeather_ClearWeather()688 {689 WorldMock world = new WorldMock();690 assertTrue(world.isClearWeather());691 }692 @Test693 void isClearWeather_Thundering_False()694 {695 WorldMock world = new WorldMock();696 world.setThundering(true);697 assertFalse(world.isClearWeather());698 }699 @Test700 void isClearWeather_Storming_False()701 {702 WorldMock world = new WorldMock();703 world.setStorm(true);704 assertFalse(world.isClearWeather());705 }706 @Test707 void spawn_AddedToEntities()708 {709 WorldMock world = new WorldMock();710 Entity zombie = world.spawnEntity(new Location(world, 0, 5, 0), EntityType.ZOMBIE);711 assertEquals(1, world.getEntities().size());712 assertEquals(zombie, world.getEntities().get(0));713 }714 @Test715 void spawn_CorrectLocation()716 {717 WorldMock world = new WorldMock();718 Location location = new Location(world, 100, 20, 50);719 Entity zombie = world.spawnEntity(location, EntityType.ZOMBIE);720 assertEquals(100, zombie.getLocation().getBlockX());721 assertEquals(20, zombie.getLocation().getBlockY());722 assertEquals(50, zombie.getLocation().getBlockZ());723 }724 @Test725 void spawn_ArmorStand_CorrectType()726 {727 WorldMock world = new WorldMock();728 Entity entity = world.spawnEntity(new Location(world, 0, 5, 0), EntityType.ARMOR_STAND);729 assertInstanceOf(ArmorStandMock.class, entity);730 }731 @Test732 void spawn_ArmorStand_CorrectEvent()733 {734 WorldMock world = new WorldMock();735 world.spawnEntity(new Location(world, 0, 5, 0), EntityType.ARMOR_STAND);736 server.getPluginManager().assertEventFired(CreatureSpawnEvent.class, (e) -> e.getSpawnReason() == CreatureSpawnEvent.SpawnReason.CUSTOM);737 server.getPluginManager().assertEventFired(CreatureSpawnEvent.class, (e) -> !e.isCancelled());738 }739 @Test740 void spawn_ExperienceOrb_CorrectType()741 {742 WorldMock world = new WorldMock();743 Entity entity = world.spawnEntity(new Location(world, 0, 5, 0), EntityType.EXPERIENCE_ORB);744 assertInstanceOf(ExperienceOrbMock.class, entity);745 }746 @Test747 void spawn_Firework_CorrectType()748 {749 WorldMock world = new WorldMock();750 Entity entity = world.spawnEntity(new Location(world, 0, 5, 0), EntityType.FIREWORK);751 assertInstanceOf(FireworkMock.class, entity);752 }753 @Test754 void spawn_Firework_CorrectEvent()755 {756 WorldMock world = new WorldMock();757 world.spawnEntity(new Location(world, 0, 5, 0), EntityType.FIREWORK);758 server.getPluginManager().assertEventFired(ProjectileLaunchEvent.class, (e) -> !e.isCancelled());759 }760 @Test761 void spawn_Item_ThrowsException()762 {763 WorldMock world = new WorldMock();764 assertThrowsExactly(IllegalArgumentException.class, () -> world.spawnEntity(new Location(world, 0, 5, 0), EntityType.DROPPED_ITEM));765 }766 @Test767 void spawn_Player_ThrowsException()768 {769 WorldMock world = new WorldMock();770 assertThrowsExactly(IllegalArgumentException.class, () -> world.spawnEntity(new Location(world, 0, 5, 0), EntityType.PLAYER));771 }772 @Test773 void spawn_Zombie_CorrectType()774 {775 WorldMock world = new WorldMock();776 Entity entity = world.spawnEntity(new Location(world, 0, 5, 0), EntityType.ZOMBIE);777 assertInstanceOf(ZombieMock.class, entity);778 }779 @Test780 void spawn_Zombie_CorrectEvent()781 {782 WorldMock world = new WorldMock();783 world.spawnEntity(new Location(world, 0, 5, 0), EntityType.ZOMBIE);784 server.getPluginManager().assertEventFired(CreatureSpawnEvent.class, (e) -> e.getSpawnReason() == CreatureSpawnEvent.SpawnReason.CUSTOM);785 server.getPluginManager().assertEventFired(CreatureSpawnEvent.class, (e) -> !e.isCancelled());786 }787 @Test788 void setDifficulty()789 {790 WorldMock world = new WorldMock(Material.DIRT, 3);791 assertNotNull(world.getDifficulty());792 world.setDifficulty(Difficulty.HARD);793 assertEquals(Difficulty.HARD, world.getDifficulty());794 }795 @Test796 void spawnMonster_Peaceful()797 {798 WorldMock world = new WorldMock(Material.DIRT, 3);799 world.setDifficulty(Difficulty.PEACEFUL);800 Entity zombie = world.spawnEntity(new Location(world, 0, 0, 0), EntityType.ZOMBIE);801 assertFalse(zombie.isValid());802 assertTrue(zombie.isDead());803 }804 @Test805 void spawnFriendly_Peaceful()806 {807 WorldMock world = new WorldMock(Material.DIRT, 3);808 world.setDifficulty(Difficulty.PEACEFUL);809 Entity armorStand = world.spawnEntity(new Location(world, 0, 0, 0), EntityType.ARMOR_STAND);810 assertTrue(armorStand.isValid());811 assertFalse(armorStand.isDead());812 }813 @Test814 void testSpawnSheep()815 {816 WorldMock world = new WorldMock(Material.DIRT, 3);817 Entity entity = world.spawnEntity(new Location(world, 0, 0, 0), EntityType.SHEEP);818 assertInstanceOf(SheepMock.class, entity);819 assertTrue(entity.isValid());820 }821 @Test822 void testSpawnAllay()823 {824 WorldMock world = new WorldMock(Material.DIRT, 3);825 Entity entity = world.spawnEntity(new Location(world, 0, 0, 0), EntityType.ALLAY);826 assertInstanceOf(AllayMock.class, entity);827 assertTrue(entity.isValid());828 }829 @Test830 void testGetAllowAnimalsDefault()831 {832 WorldMock world = new WorldMock(Material.DIRT, 3);833 assertTrue(world.getAllowAnimals());834 }835 @Test836 void testGetAllowMonstersDefault()837 {838 WorldMock world = new WorldMock(Material.DIRT, 3);839 assertTrue(world.getAllowMonsters());840 }841 @Test842 void testSetSpawnFlags()843 {844 WorldMock world = new WorldMock(Material.DIRT, 3);845 world.setSpawnFlags(false, true);846 assertFalse(world.getAllowMonsters());847 assertTrue(world.getAllowAnimals());848 world.setSpawnFlags(true, false);849 assertTrue(world.getAllowMonsters());850 assertFalse(world.getAllowAnimals());851 }852 @Test853 void testCallSpawnEventOnDisallowedMonster()854 {855 WorldMock world = new WorldMock(Material.DIRT, 3);856 world.setSpawnFlags(false, true);857 Entity zombie = world.spawn(new Location(world, 0, 0, 0), Zombie.class, CreatureSpawnEvent.SpawnReason.NATURAL);858 assertFalse(zombie.isValid());859 assertTrue(zombie.isDead());860 }861 @Test862 void testCallSpawnEventOnDisallowedAnimal()863 {864 WorldMock world = new WorldMock(Material.DIRT, 3);865 world.setSpawnFlags(true, false);866 Entity sheep = world.spawn(new Location(world, 0, 0, 0), Sheep.class, CreatureSpawnEvent.SpawnReason.NATURAL);867 assertFalse(sheep.isValid());868 }869 @Test870 void testSpawnEnderman()871 {872 WorldMock world = new WorldMock(Material.DIRT, 3);873 Entity entity = world.spawnEntity(new Location(world, 0, 0, 0), EntityType.ENDERMAN);874 assertInstanceOf(EndermanMock.class, entity);875 assertTrue(entity.isValid());876 }877 @Test878 void testSpawnWarden()879 {880 WorldMock world = new WorldMock(Material.DIRT, 3);881 Entity entity = world.spawnEntity(new Location(world, 0, 0, 0), EntityType.WARDEN);882 assertInstanceOf(WardenMock.class, entity);883 assertTrue(entity.isValid());884 }885 @Test886 void testSpawnDonkey()887 {888 WorldMock world = new WorldMock(Material.DIRT, 3);889 Entity entity = world.spawnEntity(new Location(world, 0, 0, 0), EntityType.DONKEY);890 assertInstanceOf(DonkeyMock.class, entity);891 assertTrue(entity.isValid());892 }893 @Test894 void testSpawnLlama()895 {896 WorldMock world = new WorldMock(Material.DIRT, 3);897 Entity entity = world.spawnEntity(new Location(world, 0, 0, 0), EntityType.LLAMA);898 assertInstanceOf(LlamaMock.class, entity);899 assertTrue(entity.isValid());900 }901 @Test902 void testSpawnMule()903 {904 WorldMock world = new WorldMock(Material.DIRT, 3);905 Entity entity = world.spawnEntity(new Location(world, 0, 0, 0), EntityType.MULE);906 assertInstanceOf(MuleMock.class, entity);907 assertTrue(entity.isValid());908 }909 @Test910 void testSpawnSkeletonHorse()911 {912 WorldMock world = new WorldMock(Material.DIRT, 3);913 Entity entity = world.spawnEntity(new Location(world, 0, 0, 0), EntityType.SKELETON_HORSE);914 assertInstanceOf(SkeletonHorseMock.class, entity);915 assertTrue(entity.isValid());916 }917 @Test918 void testSpawnZombieHorse()919 {920 WorldMock world = new WorldMock(Material.DIRT, 3);921 Entity entity = world.spawnEntity(new Location(world, 0, 0, 0), EntityType.ZOMBIE_HORSE);922 assertInstanceOf(ZombieHorseMock.class, entity);923 assertTrue(entity.isValid());924 }925 @Test926 void testSpawnCow()927 {928 WorldMock world = new WorldMock(Material.DIRT, 3);929 Entity entity = world.spawnEntity(new Location(world, 0, 0, 0), EntityType.COW);930 assertInstanceOf(CowMock.class, entity);931 assertTrue(entity.isValid());932 }933 @Test934 void testSpawnSkeleton()935 {936 WorldMock world = new WorldMock(Material.DIRT, 3);937 Entity entity = world.spawnEntity(new Location(world, 0, 0, 0), EntityType.SKELETON);938 assertInstanceOf(SkeletonMock.class, entity);939 assertTrue(entity.isValid());940 }941 @Test942 void testSpawnChicken()943 {944 WorldMock world = new WorldMock(Material.DIRT, 3);945 Entity entity = world.spawnEntity(new Location(world, 0, 0, 0), EntityType.CHICKEN);946 assertInstanceOf(ChickenMock.class, entity);947 assertTrue(entity.isValid());948 }949 @Test950 void testSpawnBlaze()951 {952 WorldMock world = new WorldMock(Material.DIRT, 3);953 Entity entity = world.spawnEntity(new Location(world, 0, 0, 0), EntityType.BLAZE);954 assertInstanceOf(BlazeMock.class, entity);955 assertTrue(entity.isValid());956 }957 @Test958 void testSpawnStray()959 {960 WorldMock world = new WorldMock(Material.DIRT, 3);961 Entity entity = world.spawnEntity(new Location(world, 0, 0, 0), EntityType.STRAY);962 assertInstanceOf(StrayMock.class, entity);963 assertTrue(entity.isValid());964 }965 @Test966 void testSpawnSpider()967 {968 WorldMock world = new WorldMock(Material.DIRT, 3);969 Entity entity = world.spawnEntity(new Location(world, 0, 0, 0), EntityType.SPIDER);970 assertInstanceOf(SpiderMock.class, entity);971 assertTrue(entity.isValid());972 }973 @Test974 void testSpawnWitherSkeleton()975 {976 WorldMock world = new WorldMock(Material.DIRT, 3);977 Entity entity = world.spawnEntity(new Location(world, 0, 0, 0), EntityType.WITHER_SKELETON);978 assertInstanceOf(WitherSkeletonMock.class, entity);979 assertTrue(entity.isValid());980 }981 @Test982 void testSpawnCaveSpider()983 {984 WorldMock world = new WorldMock(Material.DIRT, 3);985 Entity entity = world.spawnEntity(new Location(world, 0, 0, 0), EntityType.CAVE_SPIDER);986 assertInstanceOf(CaveSpiderMock.class, entity);987 assertTrue(entity.isValid());988 }989 @Test990 void testSpawnGiant()991 {992 WorldMock world = new WorldMock(Material.DIRT, 3);993 Entity entity = world.spawnEntity(new Location(world, 0, 0, 0), EntityType.GIANT);994 assertInstanceOf(GiantMock.class, entity);995 assertTrue(entity.isValid());996 }997 @Test998 void testSpawnAxolotl()999 {1000 WorldMock world = new WorldMock(Material.DIRT, 3);1001 Entity entity = world.spawnEntity(new Location(world, 0, 0, 0), EntityType.AXOLOTL);1002 assertInstanceOf(AxolotlMock.class, entity);1003 assertTrue(entity.isValid());1004 }1005 @Test1006 void testSpawnBat()1007 {1008 WorldMock world = new WorldMock(Material.DIRT, 3);1009 Entity entity = world.spawnEntity(new Location(world, 0, 0, 0), EntityType.BAT);1010 assertInstanceOf(BatMock.class, entity);1011 assertTrue(entity.isValid());1012 }1013 @Test1014 void testSpawnCat()1015 {1016 WorldMock world = new WorldMock(Material.DIRT, 3);1017 Entity entity = world.spawnEntity(new Location(world, 0, 0, 0), EntityType.CAT);1018 assertInstanceOf(CatMock.class, entity);1019 assertTrue(entity.isValid());1020 }1021 @Test1022 void testSpawnFrog()1023 {1024 WorldMock world = new WorldMock(Material.DIRT, 3);1025 Entity entity = world.spawnEntity(new Location(world, 0, 0, 0), EntityType.FROG);1026 assertInstanceOf(FrogMock.class, entity);1027 assertTrue(entity.isValid());1028 }1029 @Test1030 void testSpawnFox()1031 {1032 WorldMock world = new WorldMock(Material.DIRT, 3);1033 Entity entity = world.spawnEntity(new Location(world, 0, 0, 0), EntityType.FOX);1034 assertInstanceOf(FoxMock.class, entity);1035 assertTrue(entity.isValid());1036 }1037 @Test1038 void testSpawnGhast()1039 {1040 WorldMock world = new WorldMock(Material.DIRT, 3);...

Full Screen

Full Screen

Source:FrogMockTest.java Github

copy

Full Screen

...8import org.junit.jupiter.api.Test;9import java.util.UUID;10import static org.junit.jupiter.api.Assertions.assertEquals;11import static org.junit.jupiter.api.Assertions.assertNull;12class FrogMockTest13{14 private ServerMock server;15 private FrogMock frog;16 @BeforeEach17 void setup()18 {19 server = MockBukkit.mock();20 frog = new FrogMock(server, UUID.randomUUID());21 }22 @AfterEach23 void tearDown()24 {25 MockBukkit.unmock();26 }27 @Test28 void testGetTongueTargetDefault()29 {30 assertNull(frog.getTongueTarget());31 }32 @Test33 void testSetTongueTarget()34 {...

Full Screen

Full Screen

Source:FrogMock.java Github

copy

Full Screen

...6import org.bukkit.entity.Frog;7import org.jetbrains.annotations.NotNull;8import org.jetbrains.annotations.Nullable;9import java.util.UUID;10public class FrogMock extends AnimalsMock implements Frog11{12 private @Nullable Entity tongueTarget = null;13 private Variant variant = Variant.TEMPERATE;14 public FrogMock(@NotNull ServerMock server, @NotNull UUID uuid)15 {16 super(server, uuid);17 }18 @Override19 public @Nullable Entity getTongueTarget()20 {21 return this.tongueTarget;22 }23 @Override24 public void setTongueTarget(@Nullable Entity target)25 {26 this.tongueTarget = target;27 }28 @Override...

Full Screen

Full Screen

FrogMock

Using AI Code Generation

copy

Full Screen

1import static org.junit.Assert.assertEquals;2import static org.junit.Assert.assertFalse;3import static org.junit.Assert.assertTrue;4import org.bukkit.Location;5import org.bukkit.entity.Entity;6import org.bukkit.entity.Frog;7import org.junit.After;8import org.junit.Before;9import org.junit.Test;10import be.seeseemelk.mockbukkit.MockBukkit;11import be.seeseemelk.mockbukkit.entity.FrogMock;12public class FrogTest {13 private FrogMock frog;14 public void setUp()15 {16 MockBukkit.mock();17 frog = new FrogMock();18 }19 public void tearDown()20 {21 MockBukkit.unmock();22 }23 public void testIsAdult()24 {25 assertFalse(frog.isAdult());26 }27 public void testSetAdult()28 {29 frog.setAdult();30 assertTrue(frog.isAdult());31 }32 public void testSetBaby()33 {34 frog.setBaby();35 assertFalse(frog.isAdult());36 }37 public void testGetAge()38 {39 assertEquals(0, frog.getAge());40 }41 public void testSetAge()42 {43 frog.setAge(10);44 assertEquals(10, frog.getAge());45 }46 public void testGetMaxAir()47 {48 assertEquals(300, frog.getMaximumAir());49 }50 public void testSetMaxAir()51 {52 frog.setMaximumAir(200);53 assertEquals(200, frog.getMaximumAir());54 }55 public void testGetRemainingAir()56 {57 assertEquals(300, frog.getRemainingAir());58 }59 public void testSetRemainingAir()60 {61 frog.setRemainingAir(200);62 assertEquals(200, frog.getRemainingAir());63 }64 public void testGetMaxNoDamageTicks()65 {66 assertEquals(20, frog.getMaximumNoDamageTicks());67 }68 public void testSetMaxNoDamageTicks()69 {70 frog.setMaximumNoDamageTicks(10);71 assertEquals(10, frog.getMaximumNoDamageTicks());72 }73 public void testGetNoDamageTicks()74 {75 assertEquals(0, frog.getNoDamageTicks());76 }

Full Screen

Full Screen

FrogMock

Using AI Code Generation

copy

Full Screen

1package com.example.test;2import static org.junit.Assert.assertEquals;3import org.bukkit.Location;4import org.bukkit.entity.EntityType;5import org.bukkit.entity.Frog;6import org.junit.Before;7import org.junit.Test;8import be.seeseemelk.mockbukkit.MockBukkit;9import be.seeseemelk.mockbukkit.entity.FrogMock;10public class TestFrogMock {11 public void setUp()12 {13 MockBukkit.mock();14 }15 public void testFrogMock()16 {17 Frog frog = new FrogMock(MockBukkit.getMock().getServer(), new Location(null, 0, 0, 0));18 assertEquals(EntityType.FROG, frog.getType());19 }20}21 at org.junit.Assert.assertEquals(Assert.java:115)22 at org.junit.Assert.assertEquals(Assert.java:144)23 at com.example.test.TestFrogMock.testFrogMock(TestFrogMock.java:20)24 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)25 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)26 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)27 at java.lang.reflect.Method.invoke(Method.java:498)28 at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)29 at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)30 at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)31 at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)32 at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)33 at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)34 at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)35 at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)36 at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)37 at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)38 at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)39 at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)40 at org.junit.runners.ParentRunner.run(ParentRunner

Full Screen

Full Screen

FrogMock

Using AI Code Generation

copy

Full Screen

1{2 private boolean isSitting = false;3 private boolean isJumping = false;4 private boolean isCrouching = false;5 private boolean isSwimming = false;6 private boolean isBlinking = false;7 private boolean isPlayingDead = false;8 private boolean isBegging = false;9 private boolean isJumpingUp = false;10 private boolean isSwimmingUp = false;11 private boolean isSwimmingDown = false;12 private boolean isSwimmingAway = false;13 private boolean isSwimmingTowards = false;14 private boolean isSwimmingLeft = false;15 private boolean isSwimmingRight = false;16 private boolean isSwimmingRandom = false;17 private boolean isSwimmingIdle = false;18 private boolean isSwimmingUpIdle = false;19 private boolean isSwimmingDownIdle = false;20 private boolean isSwimmingAwayIdle = false;21 private boolean isSwimmingTowardsIdle = false;22 private boolean isSwimmingLeftIdle = false;23 private boolean isSwimmingRightIdle = false;24 private boolean isSwimmingRandomIdle = false;25 private boolean isSittingIdle = false;26 private boolean isCrouchingIdle = false;27 private boolean isJumpingIdle = false;28 private boolean isBlinkingIdle = false;29 private boolean isPlayingDeadIdle = false;30 private boolean isBeggingIdle = false;31 private boolean isJumpingUpIdle = false;32 private boolean isSittingSwimming = false;33 private boolean isCrouchingSwimming = false;34 private boolean isJumpingSwimming = false;35 private boolean isBlinkingSwimming = false;36 private boolean isPlayingDeadSwimming = false;37 private boolean isBeggingSwimming = false;38 private boolean isJumpingUpSwimming = false;39 private boolean isSittingSwimmingIdle = false;40 private boolean isCrouchingSwimmingIdle = false;41 private boolean isJumpingSwimmingIdle = false;42 private boolean isBlinkingSwimmingIdle = false;43 private boolean isPlayingDeadSwimmingIdle = false;44 private boolean isBeggingSwimmingIdle = false;45 private boolean isJumpingUpSwimmingIdle = false;

Full Screen

Full Screen

FrogMock

Using AI Code Generation

copy

Full Screen

1import static org.junit.Assert.*;2import static org.mockito.Mockito.*;3import org.junit.*;4import org.bukkit.*;5import org.bukkit.entity.*;6import org.bukkit.plugin.*;7import org.bukkit.event.*;8import org.bukkit.event.player.*;9import org.bukkit.event.entity.*;10import org.bukkit.event.inventory.*;11import org.bukkit.event.block.*;12import org.bukkit.event.vehicle.*;13import org.bukkit.event.weather.*;14import org.bukkit.event.server.*;15import org.bukkit.event.enchantment.*;16import org.bukkit.event.hanging.*;17import org.bukkit.event.painting.*;18import org.bukkit.event.entity.*;19import org.bukkit.event.entity.CreatureSpawnEvent.*;20import org.bukkit.event.entity.EntityDamageEvent.*;21import org.bukkit.event.entity.EntityDeathEvent.*;22import org.bukkit.event.entity.EntityTargetEvent.*;23import org.bukkit.event.entity.EntityTargetLivingEntityEvent.*;24import org.bukkit.event.entity.EntityTeleportEvent.*;25import org.bukkit.event.entity.EntityUnleashEvent.*;26import org.bukkit.event.entity.FoodLevelChangeEvent.*;27import org.bukkit.event.entity.PotionSplashEvent.*;28import org.bukkit.event.entity.ProjectileHitEvent.*;29import org.bukkit.event.entity.ProjectileLaunchEvent.*;30import org.bukkit.event.entity.CreeperPowerEvent.*;31import org.bukkit.event.entity.EntityBreakDoorEvent.*;32import org.bukkit.event.entity.EntityChangeBlockEvent.*;33import org.bukkit.event.entity.EntityCombustByBlockEvent.*;34import org.bukkit.event.entity.EntityCombustByEntityEvent.*;35import org.bukkit.event.entity.EntityCombustEvent.*;36import org.bukkit.event.entity.EntityCreatePortalEvent.*;37import org.bukkit.event.entity.EntityDamageByBlockEvent.*;38import org.bukkit.event.entity.EntityDamageByEntityEvent.*;39import org.bukkit.event.entity.EntityDeathEvent.*;40import org.bukkit.event.entity.EntityExplodeEvent.*;41import org.bukkit.event.entity.EntityInteractEvent.*;42import org.bukkit.event.entity.EntityPortalEnterEvent.*;43import org.bukkit.event.entity.EntityPortalEvent.*;44import org.bukkit.event.entity.EntityPortalExitEvent.*;45import org.bukkit.event.entity.EntityRegainHealthEvent.*;46import org.bukkit.event.entity.EntityShootBowEvent.*;47import org.bukkit.event.entity.EntityTameEvent.*;48import org.bukkit.event.entity.EntityTargetEvent.*;49import org.bukkit.event.entity.EntityTargetLivingEntityEvent.*;50import org.bukkit.event.entity.EntityTeleportEvent.*;51import org.bukkit.event.entity.EntityUnleashEvent.*;52import org.bukkit.event.entity.ExpBottleEvent.*;53import org.bukkit.event.entity.ExplosionPrimeEvent.*;54import org.bukkit.event.entity.FireworkExplodeEvent.*;55import org.bukkit.event.entity.FoodLevelChangeEvent.*;56import org.bukkit.event.entity.HorseJumpEvent.*;57import org.bukkit.event.entity.ItemDes

Full Screen

Full Screen

FrogMock

Using AI Code Generation

copy

Full Screen

1package com.mypackage;2import org.bukkit.Location;3import org.bukkit.entity.Frog;4import org.junit.jupiter.api.Test;5import be.seeseemelk.mockbukkit.entity.FrogMock;6class FrogTest {7 void test() {8 Frog frog = new FrogMock(new Location(null, 0, 0, 0));9 frog.setJumpStrength(0.5);10 frog.setJumpStrength(1.0);11 frog.setJumpStrength(2.0);12 frog.setJumpStrength(4.0);13 }14}15 at be.seeseemelk.mockbukkit.entity.FrogMock.setJumpStrength(FrogMock.java:39)16 at com.mypackage.FrogTest.test(FrogTest.java:15)17 at com.mypackage.FrogTest.main(FrogTest.java:10)

Full Screen

Full Screen

FrogMock

Using AI Code Generation

copy

Full Screen

1import be.seeseemelk.mockbukkit.entity.FrogMock;2import org.bukkit.entity.EntityType;3import org.bukkit.entity.LivingEntity;4import org.bukkit.entity.Player;5import org.bukkit.entity.Projectile;6import org.bukkit.entity.Frog;7import org.bukkit.entity.Arrow;8import org.bukkit.entity.Skeleton;9import org.bukkit.entity.Skeleton;10import org.bukkit.entity.Entity;11import org.bukkit.entity.EntityType;

Full Screen

Full Screen

FrogMock

Using AI Code Generation

copy

Full Screen

1import java.util.UUID;2import org.bukkit.Location;3import org.bukkit.entity.EntityType;4import org.bukkit.entity.Frog;5import be.seeseemelk.mockbukkit.MockBukkit;6import be.seeseemelk.mockbukkit.entity.FrogMock;7{8 public static void main(String[] args)9 {10 MockBukkit.mock();11 Frog frog = new FrogMock(null, UUID.randomUUID());12 frog.setCustomName("FrogMock");13 frog.setCustomNameVisible(true);14 frog.setGlowing(true);15 frog.setInvulnerable(true);16 frog.setSilent(true);17 frog.setTicksLived(100);18 frog.setVelocity(frog.getVelocity());19 frog.teleport(new Location(null, 1, 2, 3));20 frog.teleport(frog);21 frog.teleport(null);22 frog.remove();23 frog.setPersistent(true);24 frog.setGravity(true);25 frog.setInvulnerable(false);26 frog.setGlowing(false);27 frog.setSilent(false);28 frog.setCustomNameVisible(false);29 frog.setCustomName(null);30 frog.getUniqueId();31 frog.getScoreboardTags();32 frog.addScoreboardTag("tag");33 frog.removeScoreboardTag("tag");34 frog.hasScoreboardTag("tag");35 frog.setCustomNameVisible(true);36 frog.setCustomName("FrogMock");37 frog.setGlowing(true);38 frog.setInvulnerable(true);39 frog.setSilent(true);40 frog.setTicksLived(100);41 frog.setVelocity(frog.getVelocity());42 frog.teleport(new Location(null, 1, 2, 3));43 frog.teleport(frog);44 frog.teleport(null);45 frog.remove();46 frog.setPersistent(true);47 frog.setGravity(true);48 frog.setInvulnerable(false);49 frog.setGlowing(false);50 frog.setSilent(false);51 frog.setCustomNameVisible(false);52 frog.setCustomName(null);53 frog.getUniqueId();54 frog.getScoreboardTags();55 frog.addScoreboardTag("tag");56 frog.removeScoreboardTag("tag");57 frog.hasScoreboardTag("tag");58 frog.getUniqueId();59 frog.getScoreboardTags();60 frog.addScoreboardTag("tag");61 frog.removeScoreboardTag("tag

Full Screen

Full Screen

FrogMock

Using AI Code Generation

copy

Full Screen

1import org.bukkit.Material;2import org.bukkit.block.Block;3import org.bukkit.entity.Player;4import org.bukkit.event.block.Action;5import org.bukkit.event.player.PlayerInteractEvent;6import org.junit.jupiter.api.BeforeEach;7import org.junit.jupiter.api.Test;8import org.junit.jupiter.api.extension.ExtendWith;9import org.mockito.Mock;10import org.mockito.junit.jupiter.MockitoExtension;11import be.seeseemelk.mockbukkit.MockBukkit;12import be.seeseemelk.mockbukkit.entity.FrogMock;13import be.seeseemelk.mockbukkit.entity.PlayerMock;14import be.seeseemelk.mockbukkit.event.player.PlayerInteractEventMock;15import be.seeseemelk.mockbukkit.inventory.InventoryMock;16import be.seeseemelk.mockbukkit.inventory.ItemStackBuilder;17import be.seeseemelk.mockbukkit.inventory.meta.ItemMetaMock;18import be.seeseemelk.mockbukkit.inventory.meta.SkullMetaMock;19import be.seeseemelk.mockbukkit.plugin.MockPlugin;20import be.seeseemelk.mockbukkit.scheduler.BukkitSchedulerMock;21import static org.junit.jupiter.api.Assertions.*;22import static org.mockito.Mockito.*;23@ExtendWith(MockitoExtension.class)24{25 private FrogPlugin plugin;26 private Player player;27 private PlayerInteractEventMock event;28 private InventoryMock inventory;29 private Block block;30 private ItemStackBuilder itemStackBuilder;31 private ItemMetaMock itemMetaMock;32 private SkullMetaMock skullMetaMock;33 private FrogMock frogMock;34 void setUp()35 {36 plugin = MockBukkit.load(FrogPlugin.class);37 player = new PlayerMock(plugin, "player");38 block = mock(Block.class);39 when(block.getType()).thenReturn(Material.FURNACE);40 inventory = new InventoryMock();41 itemStackBuilder = new ItemStackBuilder(Material.PLAYER_HEAD);42 itemMetaMock = itemStackBuilder.getItemMeta();

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run MockBukkit automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Test Your Web Or Mobile Apps On 3000+ Browsers

Signup for free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful