use of net.glowstone.scoreboard.GlowScoreboard in project Glowstone by GlowstoneMC.
the class GlowEntityTest method setUp.
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
when(server.getItemFactory()).thenReturn(itemFactory);
when(server.getPluginManager()).thenReturn(pluginManager);
ServerProvider.setMockServer(server);
log = Logger.getLogger(getClass().getSimpleName());
when(server.getLogger()).thenReturn(log);
location = new Location(world, 0, 0, 0);
when(world.getServer()).thenReturn(server);
when(world.getDifficulty()).thenReturn(Difficulty.NORMAL);
when(server.getWorlds()).thenReturn(Collections.singletonList(world));
when(world.getBlockAt(any(Location.class))).thenReturn(block);
when(block.getType()).thenReturn(Material.DIRT);
when(block.getRelative(any(BlockFace.class))).thenReturn(block);
when(world.getChunkAt(any(Location.class))).thenReturn(chunk);
when(world.getChunkAt(any(Block.class))).thenReturn(chunk);
when(world.getChunkAt(anyInt(), anyInt())).thenReturn(chunk);
when(world.getChunk(notNull())).thenReturn(chunk);
when(world.getGameRuleMap()).thenReturn(new GameRuleManager());
when(server.getItemFactory()).thenReturn(itemFactory);
entityManager = Mockito.spy(new EntityManager());
when(world.getEntityManager()).thenReturn(entityManager);
idManager = new EntityIdManager();
when(server.getEntityIdManager()).thenReturn(idManager);
when(server.getScoreboardManager()).thenReturn(scoreboardManager);
scoreboard = new GlowScoreboard();
when(scoreboardManager.getMainScoreboard()).thenReturn(scoreboard);
when(itemFactory.ensureServerConversions(any(ItemStack.class))).thenAnswer(returnsFirstArg());
oldEventFactory = EventFactory.getInstance();
EventFactory.setInstance(eventFactory);
when(eventFactory.callEvent(any(Event.class))).thenAnswer(returnsFirstArg());
if (createEntityInSuperSetUp()) {
entity = entityCreator.apply(location);
}
when(eventFactory.onEntityDamage(any(EntityDamageEvent.class))).thenAnswer(returnsFirstArg());
inventory = new GlowPlayerInventory(player);
when(player.getInventory()).thenReturn(inventory);
when(player.getGameMode()).thenReturn(GameMode.SURVIVAL);
}
Aggregations