Fresh production baseline [skip ci]
This commit is contained in:
commit
0a11a18274
1 changed files with 229644 additions and 0 deletions
|
|
@ -0,0 +1,15 @@
|
|||
package com.example.duneterrain;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.data.Waterlogged;
|
||||
|
||||
class PlanetSoilTest {
|
||||
private Block soil(World world){Block block=mock(Block.class);when(block.getWorld()).thenReturn(world);when(block.getX()).thenReturn(8);when(block.getZ()).thenReturn(8);when(block.getY()).thenReturn(64);when(world.getMaxHeight()).thenReturn(320);return block;}
|
||||
@Test void anyRoofIncludingGlassAndLeavesPreventsExposure(){World world=mock(World.class);Block block=soil(world);when(world.getHighestBlockYAt(8,8,HeightMap.WORLD_SURFACE)).thenReturn(64,65,150);assertTrue(PlanetSoil.exposed(block));assertFalse(PlanetSoil.exposed(block));assertFalse(PlanetSoil.exposed(block));}
|
||||
@Test void waterAtFarmlandBoundaryHydratesButOutsideDoesNot(){World world=mock(World.class);Block block=soil(world),air=mock(Block.class),water=mock(Block.class);when(world.isChunkLoaded(anyInt(),anyInt())).thenReturn(true);when(world.getBlockAt(anyInt(),anyInt(),anyInt())).thenReturn(air);when(air.getType()).thenReturn(Material.AIR);when(water.getType()).thenReturn(Material.WATER);when(world.getBlockAt(13,64,8)).thenReturn(water);assertFalse(PlanetSoil.hydrated(block));when(world.getBlockAt(12,65,8)).thenReturn(water);assertTrue(PlanetSoil.hydrated(block));}
|
||||
@Test void waterloggedBlocksHydrateAndUnloadedNeighborsNeverLoad(){World world=mock(World.class);Block block=soil(world),air=mock(Block.class),wet=mock(Block.class);when(world.isChunkLoaded(anyInt(),anyInt())).thenReturn(true);when(world.getBlockAt(anyInt(),anyInt(),anyInt())).thenReturn(air);when(air.getType()).thenReturn(Material.AIR);var data=mock(Waterlogged.class);when(data.isWaterlogged()).thenReturn(true);when(wet.getType()).thenReturn(Material.OAK_SLAB);when(wet.getBlockData()).thenReturn(data);when(world.getBlockAt(8,64,8)).thenReturn(wet);assertTrue(PlanetSoil.hydrated(block));reset(world);when(world.isChunkLoaded(anyInt(),anyInt())).thenReturn(false);assertTrue(PlanetSoil.hydrated(block));verify(world,never()).getBlockAt(anyInt(),anyInt(),anyInt());}
|
||||
@Test void climateTouchesOnlyAgreedSoilAndWorlds(){assertTrue(PlanetSoil.source(Material.DIRT));assertTrue(PlanetSoil.source(Material.GRASS_BLOCK));assertFalse(PlanetSoil.source(Material.FARMLAND));assertEquals(Material.SAND,PlanetSoil.target("arrakis"));assertEquals(Material.COARSE_DIRT,PlanetSoil.target("giedi_prime"));assertEquals(Material.GRASS_BLOCK,PlanetSoil.target("sigma_draconis_iv"));assertNull(PlanetSoil.target("caladan"));assertNull(PlanetSoil.target("giedi_prime_nether"));}
|
||||
}
|
||||
Loading…
Reference in a new issue

Staff