package com.example.duneterrain; import org.bukkit.Material; import org.bukkit.generator.*; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.*; import static org.mockito.ArgumentMatchers.*; class PlanetUpgradeTest { @Test void formationGroupsLeaveMostCellsOpenAndRetainNineMembersPerGroup(){for(int sx=-3;sx<=3;sx++)for(int sz=-3;sz<=3;sz++){int active=0;for(int x=0;x<8;x++)for(int z=0;z<8;z++)if(RockPlateaus.activeCell(sx*8+x,sz*8+z))active++;assertEquals(9,active);}} @Test void ordosTerracottaRegionsExistWithoutCoveringTheWholePlanet(){int count=0;for(int x=-8000;x<8000;x+=71)for(int z=-8000;z<8000;z+=79)if(TemperateLandscape.ordosBadlands(884711,x,z))count++;assertTrue(count>25);assertTrue(count<10000);} @Test void reservoirHasAnEnclosedLinerSolidBottomAndCornerFoundations(){var r=mock(LimitedRegion.class);when(r.isInRegion(anyInt(),anyInt(),anyInt())).thenReturn(true);SietchReservoirs.build(r,10,40,20,3,3,2);verify(r).setType(10,40,20,Material.STONE_BRICKS);verify(r).setType(10,41,20,Material.WATER);verify(r).setType(13,41,23,Material.CUT_SANDSTONE);verify(r).setType(13,34,23,Material.SANDSTONE);verify(r,never()).setType(13,41,23,Material.WATER);} @Test void newArrakisCavesLoseAquiferWaterButKeepStoneAndLava(){var w=mock(WorldInfo.class);when(w.getMinHeight()).thenReturn(-64);var data=mock(ChunkGenerator.ChunkData.class);when(data.getMinHeight()).thenReturn(-64);when(data.getMaxHeight()).thenReturn(80);when(data.getType(anyInt(),anyInt(),anyInt())).thenReturn(Material.STONE);when(data.getType(3,20,4)).thenReturn(Material.WATER);when(data.getType(5,-20,6)).thenReturn(Material.LAVA);OceanAquifers.flood(w,0,0,data,"arrakis");verify(data).setBlock(3,20,4,Material.AIR);verify(data,never()).setBlock(eq(5),eq(-20),eq(6),any(Material.class));} }