Fix BiomeRecipe tests.

Added a test for ConvertBlock with localBlock == null,
Removed unnecessary test for trying to convert a block outside of a greenhouse,
Fixed @Links for addPlants having wrong parameters
This commit is contained in:
Rosskaman 2021-04-21 23:26:31 +02:00
parent 94e6ecc448
commit 8a7e9e1003
1 changed files with 25 additions and 24 deletions

View File

@ -156,7 +156,7 @@ public class BiomeRecipeTest {
}
/**
* Test method for {@link world.bentobox.greenhouses.greenhouse.BiomeRecipe#addMobs(org.bukkit.entity.EntityType, int, org.bukkit.Material)}.
* Test method for {@link world.bentobox.greenhouses.greenhouse.BiomeRecipe#addMobs(org.bukkit.entity.EntityType, double, org.bukkit.Material)}.
*/
@Test
public void testAddMobs() {
@ -168,7 +168,7 @@ public class BiomeRecipeTest {
}
/**
* Test method for {@link world.bentobox.greenhouses.greenhouse.BiomeRecipe#addMobs(org.bukkit.entity.EntityType, int, org.bukkit.Material)}.
* Test method for {@link world.bentobox.greenhouses.greenhouse.BiomeRecipe#addMobs(org.bukkit.entity.EntityType, double, org.bukkit.Material)}.
*/
@Test
public void testAddMobsOver100Percent() {
@ -182,7 +182,7 @@ public class BiomeRecipeTest {
}
/**
* Test method for {@link world.bentobox.greenhouses.greenhouse.BiomeRecipe#addMobs(org.bukkit.entity.EntityType, int, org.bukkit.Material)}.
* Test method for {@link world.bentobox.greenhouses.greenhouse.BiomeRecipe#addMobs(org.bukkit.entity.EntityType, double, org.bukkit.Material)}.
*/
@Test
public void testAddMobsOver100PercentDouble() {
@ -195,7 +195,7 @@ public class BiomeRecipeTest {
}
/**
* Test method for {@link world.bentobox.greenhouses.greenhouse.BiomeRecipe#addPlants(org.bukkit.Material, int, org.bukkit.Material)}.
* Test method for {@link world.bentobox.greenhouses.greenhouse.BiomeRecipe#addPlants(org.bukkit.Material, double, org.bukkit.Material)}.
*/
@Test
public void testAddPlants() {
@ -207,7 +207,7 @@ public class BiomeRecipeTest {
}
/**
* Test method for {@link world.bentobox.greenhouses.greenhouse.BiomeRecipe#addPlants(org.bukkit.Material, int, org.bukkit.Material)}.
* Test method for {@link world.bentobox.greenhouses.greenhouse.BiomeRecipe#addPlants(org.bukkit.Material, double, org.bukkit.Material)}.
*/
@Test
public void testAddPlantsOver100Percent() {
@ -267,25 +267,6 @@ public class BiomeRecipeTest {
verify(b).setType(Material.CLAY);
}
/**
* Test method for {@link world.bentobox.greenhouses.greenhouse.BiomeRecipe#convertBlock(org.bukkit.block.Block)}.
*/
@Test
public void testConvertBlockNotInGreenhouse() {
// Setup
this.testAddConvBlocks();
// Mock
Block b = mock(Block.class);
when(b.getType()).thenReturn(Material.SAND);
Block ab = mock(Block.class);
when(ab.getType()).thenReturn(Material.WATER);
when(b.getRelative(any())).thenReturn(ab);
when(ab.getLocation()).thenReturn(location);
when(gh.contains(any())).thenReturn(false);
br.convertBlock(b);
verify(b, never()).setType(any());
}
/**
* Test method for {@link world.bentobox.greenhouses.greenhouse.BiomeRecipe#convertBlock(org.bukkit.block.Block)}.
*/
@ -315,6 +296,26 @@ public class BiomeRecipeTest {
verify(b, never()).setType(Material.CLAY);
}
/**
* Test method for {@link world.bentobox.greenhouses.greenhouse.BiomeRecipe#convertBlock(org.bukkit.block.Block)}.
*/
@Test
public void testConvertBlockNoLocalBlock() {
// Setup
Material oldMaterial = Material.SAND;
Material newMaterial = Material.CLAY;
double convChance = 100D;
br.addConvBlocks(oldMaterial, newMaterial, convChance, null);
// Mock
Block b = mock(Block.class);
when(b.getType()).thenReturn(Material.SAND);
br.convertBlock(b);
verify(b, never()).getRelative(any());
verify(b).setType(Material.CLAY);
}
/**
* Test method for {@link world.bentobox.greenhouses.greenhouse.BiomeRecipe#convertBlock(org.bukkit.block.Block)}.
*/