Fix tests for 1.16
This commit is contained in:
parent
3a5a866ea5
commit
27edda539c
|
@ -18,6 +18,7 @@ import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.generator.ChunkGenerator.BiomeGrid;
|
import org.bukkit.generator.ChunkGenerator.BiomeGrid;
|
||||||
import org.bukkit.generator.ChunkGenerator.ChunkData;
|
import org.bukkit.generator.ChunkGenerator.ChunkData;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
|
@ -68,10 +69,14 @@ public class ChunkGeneratorWorldTest {
|
||||||
cg = new ChunkGeneratorWorld(addon);
|
cg = new ChunkGeneratorWorld(addon);
|
||||||
// World
|
// World
|
||||||
when(world.getEnvironment()).thenReturn(World.Environment.NORMAL);
|
when(world.getEnvironment()).thenReturn(World.Environment.NORMAL);
|
||||||
|
when(world.getMaxHeight()).thenReturn(16);
|
||||||
// Settings
|
// Settings
|
||||||
when(addon.getSettings()).thenReturn(settings);
|
when(addon.getSettings()).thenReturn(settings);
|
||||||
when(settings.getSeaHeight()).thenReturn(0);
|
when(settings.getSeaHeight()).thenReturn(0);
|
||||||
when(settings.isNetherRoof()).thenReturn(true);
|
when(settings.isNetherRoof()).thenReturn(true);
|
||||||
|
when(settings.getDefaultBiome()).thenReturn(Biome.TAIGA);
|
||||||
|
when(settings.getDefaultNetherBiome()).thenReturn(Biome.CRIMSON_FOREST);
|
||||||
|
when(settings.getDefaultEndBiome()).thenReturn(Biome.END_MIDLANDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -91,7 +96,7 @@ public class ChunkGeneratorWorldTest {
|
||||||
// Verifications
|
// Verifications
|
||||||
// Default biome
|
// Default biome
|
||||||
verify(settings).getDefaultBiome();
|
verify(settings).getDefaultBiome();
|
||||||
verify(biomeGrid, times(16 * 16)).setBiome(anyInt(), anyInt(), any());
|
verify(biomeGrid, times(64)).setBiome(anyInt(), anyInt(), anyInt(), any());
|
||||||
// Sea height
|
// Sea height
|
||||||
verify(settings).getSeaHeight();
|
verify(settings).getSeaHeight();
|
||||||
// Void
|
// Void
|
||||||
|
@ -110,7 +115,7 @@ public class ChunkGeneratorWorldTest {
|
||||||
// Verifications
|
// Verifications
|
||||||
// Default biome
|
// Default biome
|
||||||
verify(settings).getDefaultBiome();
|
verify(settings).getDefaultBiome();
|
||||||
verify(biomeGrid, times(16 * 16)).setBiome(anyInt(), anyInt(), any());
|
verify(biomeGrid, times(64)).setBiome(anyInt(), anyInt(), anyInt(), eq(Biome.TAIGA));
|
||||||
// Sea height
|
// Sea height
|
||||||
verify(settings, times(2)).getSeaHeight();
|
verify(settings, times(2)).getSeaHeight();
|
||||||
// Water. Blocks = 16 x 16 x 11 because block 0
|
// Water. Blocks = 16 x 16 x 11 because block 0
|
||||||
|
@ -127,9 +132,9 @@ public class ChunkGeneratorWorldTest {
|
||||||
assertEquals(data, cd);
|
assertEquals(data, cd);
|
||||||
// Verifications
|
// Verifications
|
||||||
// Default biome
|
// Default biome
|
||||||
verify(settings, never()).getDefaultBiome();
|
verify(settings).getDefaultEndBiome();
|
||||||
// Never set biome in end
|
// Set biome in end
|
||||||
verify(biomeGrid, never()).setBiome(anyInt(), anyInt(), any());
|
verify(biomeGrid, times(64)).setBiome(anyInt(), anyInt(), anyInt(), eq(Biome.END_MIDLANDS));
|
||||||
// Sea height
|
// Sea height
|
||||||
verify(settings, never()).getSeaHeight();
|
verify(settings, never()).getSeaHeight();
|
||||||
// Void
|
// Void
|
||||||
|
@ -147,10 +152,10 @@ public class ChunkGeneratorWorldTest {
|
||||||
// Verifications
|
// Verifications
|
||||||
// Nether roof check
|
// Nether roof check
|
||||||
verify(settings).isNetherRoof();
|
verify(settings).isNetherRoof();
|
||||||
// Never set biome in nether
|
// Set biome in nether
|
||||||
verify(biomeGrid, never()).setBiome(anyInt(), anyInt(), any());
|
verify(biomeGrid, times(64)).setBiome(anyInt(), anyInt(), anyInt(), eq(Biome.CRIMSON_FOREST));
|
||||||
// Nether roof - at least bedrock layer
|
// Nether roof - at least bedrock layer
|
||||||
verify(cd, atLeast(16 * 16)).setBlock(anyInt(), anyInt(), anyInt(), eq(Material.BEDROCK));
|
verify(cd, atLeast(64)).setBlock(anyInt(), anyInt(), anyInt(), eq(Material.BEDROCK));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -163,10 +168,11 @@ public class ChunkGeneratorWorldTest {
|
||||||
ChunkData cd = cg.generateChunkData(world, random, 0 , 0 , biomeGrid);
|
ChunkData cd = cg.generateChunkData(world, random, 0 , 0 , biomeGrid);
|
||||||
assertEquals(data, cd);
|
assertEquals(data, cd);
|
||||||
// Verifications
|
// Verifications
|
||||||
|
verify(settings).getDefaultNetherBiome();
|
||||||
// Nether roof check
|
// Nether roof check
|
||||||
verify(settings).isNetherRoof();
|
verify(settings).isNetherRoof();
|
||||||
// Never set biome in nether
|
// Set biome in nether
|
||||||
verify(biomeGrid, never()).setBiome(anyInt(), anyInt(), any());
|
verify(biomeGrid, times(64)).setBiome(anyInt(), anyInt(), anyInt(), eq(Biome.CRIMSON_FOREST));
|
||||||
// Nether roof - at least bedrock layer
|
// Nether roof - at least bedrock layer
|
||||||
verify(cd, never()).setBlock(anyInt(), anyInt(), anyInt(), any(Material.class));
|
verify(cd, never()).setBlock(anyInt(), anyInt(), anyInt(), any(Material.class));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue