-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6e13cbf
commit d01e016
Showing
4 changed files
with
163 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
125 changes: 53 additions & 72 deletions
125
src/test/java/world/bentobox/greenhouses/greenhouse/RoofTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,171 +1,152 @@ | ||
package world.bentobox.greenhouses.greenhouse; | ||
|
||
import static org.junit.Assert.fail; | ||
import static org.mockito.Mockito.mock; | ||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertTrue; | ||
import static org.mockito.ArgumentMatchers.any; | ||
import static org.mockito.ArgumentMatchers.anyInt; | ||
import static org.mockito.Mockito.when; | ||
|
||
import org.bukkit.Location; | ||
import org.bukkit.Material; | ||
import org.bukkit.World; | ||
import org.bukkit.block.Block; | ||
import org.junit.Before; | ||
import org.junit.Ignore; | ||
import org.junit.Test; | ||
import org.mockito.Mockito; | ||
import org.junit.runner.RunWith; | ||
import org.mockito.Mock; | ||
import org.powermock.modules.junit4.PowerMockRunner; | ||
|
||
|
||
/** | ||
* @author tastybento | ||
* | ||
*/ | ||
@RunWith(PowerMockRunner.class) | ||
public class RoofTest { | ||
|
||
private Roof roof; | ||
@Mock | ||
private Block block; | ||
@Mock | ||
private Location location; | ||
@Mock | ||
private World world; | ||
|
||
/** | ||
* @throws java.lang.Exception | ||
*/ | ||
@Before | ||
public void setUp() throws Exception { | ||
location = mock(Location.class); | ||
World world = mock(World.class); | ||
when(world.getMaxHeight()).thenReturn(255); | ||
block = mock(Block.class); | ||
when(block.getType()).thenReturn(Material.GLASS); | ||
when(world.getBlockAt(Mockito.anyInt(), Mockito.anyInt(), Mockito.anyInt())).thenReturn(block); | ||
// Block | ||
when(block.getType()).thenReturn(Material.AIR, Material.AIR, Material.AIR, Material.AIR, Material.AIR, | ||
Material.GLASS, Material.GLASS, Material.GLASS, Material.GLASS, | ||
Material.GLASS, Material.GLASS, Material.GLASS, Material.GLASS, | ||
Material.GLASS, Material.GLASS, Material.GLASS, Material.GLASS, | ||
Material.GLASS, Material.GLASS, Material.GLASS, Material.GLASS, | ||
Material.GLASS, Material.GLASS, Material.GLASS, Material.GLASS, | ||
Material.AIR, | ||
Material.GLASS, Material.GLASS, Material.GLASS, Material.GLASS, | ||
Material.GLASS, Material.GLASS, Material.GLASS, Material.GLASS, | ||
Material.GLASS, Material.GLASS, Material.GLASS, Material.GLASS, | ||
Material.GLASS, Material.GLASS, Material.GLASS, Material.GLASS, | ||
Material.GLASS, Material.GLASS, Material.GLASS, Material.GLASS, | ||
Material.AIR, | ||
Material.GLASS, Material.GLASS, Material.GLASS, Material.GLASS, | ||
Material.GLASS, Material.GLASS, Material.GLASS, Material.GLASS, | ||
Material.GLASS, Material.GLASS, Material.GLASS, Material.GLASS, | ||
Material.GLASS, Material.GLASS, Material.GLASS, Material.GLASS, | ||
Material.GLASS, Material.GLASS, Material.GLASS, Material.GLASS, | ||
Material.AIR, | ||
Material.GLASS, Material.GLASS, Material.GLASS, Material.GLASS, | ||
Material.GLASS, Material.GLASS, Material.GLASS, Material.GLASS, | ||
Material.GLASS, Material.GLASS, Material.GLASS, Material.GLASS, | ||
Material.GLASS, Material.GLASS, Material.GLASS, Material.GLASS, | ||
Material.GLASS, Material.GLASS, Material.GLASS, Material.GLASS, | ||
Material.AIR); | ||
when(world.getBlockAt(anyInt(), anyInt(), anyInt())).thenReturn(block); | ||
when(world.getBlockAt(any(Location.class))).thenReturn(block); | ||
when(location.getWorld()).thenReturn(world); | ||
when(location.getBlockX()).thenReturn(10); | ||
when(location.getBlockY()).thenReturn(10); | ||
when(location.getBlockZ()).thenReturn(10); | ||
when(location.getBlock()).thenReturn(block); | ||
when(location.clone()).thenReturn(location); | ||
|
||
} | ||
|
||
/** | ||
* Test method for {@link world.bentobox.greenhouses.greenhouse.Roof#Roof(org.bukkit.Location)}. | ||
*/ | ||
@Ignore | ||
@Test | ||
public void testRoof() { | ||
//roof = new Roof(location); | ||
// Test | ||
roof = new Roof(location); | ||
} | ||
|
||
/** | ||
* Test method for {@link world.bentobox.greenhouses.greenhouse.Roof#getMinX()}. | ||
*/ | ||
@Ignore | ||
@Test | ||
public void testGetMinX() { | ||
fail("Not yet implemented"); // TODO | ||
} | ||
|
||
/** | ||
* Test method for {@link world.bentobox.greenhouses.greenhouse.Roof#setMinX(int)}. | ||
*/ | ||
@Ignore | ||
@Test | ||
public void testSetMinX() { | ||
fail("Not yet implemented"); // TODO | ||
assertEquals(-9, roof.getMinX()); | ||
} | ||
|
||
/** | ||
* Test method for {@link world.bentobox.greenhouses.greenhouse.Roof#getMaxX()}. | ||
*/ | ||
@Ignore | ||
@Test | ||
public void testGetMaxX() { | ||
fail("Not yet implemented"); // TODO | ||
} | ||
|
||
/** | ||
* Test method for {@link world.bentobox.greenhouses.greenhouse.Roof#setMaxX(int)}. | ||
*/ | ||
@Ignore | ||
@Test | ||
public void testSetMaxX() { | ||
fail("Not yet implemented"); // TODO | ||
assertEquals(28, roof.getMaxX()); | ||
} | ||
|
||
/** | ||
* Test method for {@link world.bentobox.greenhouses.greenhouse.Roof#getMinZ()}. | ||
*/ | ||
@Ignore | ||
@Test | ||
public void testGetMinZ() { | ||
fail("Not yet implemented"); // TODO | ||
} | ||
|
||
/** | ||
* Test method for {@link world.bentobox.greenhouses.greenhouse.Roof#setMinZ(int)}. | ||
*/ | ||
@Ignore | ||
@Test | ||
public void testSetMinZ() { | ||
fail("Not yet implemented"); // TODO | ||
assertEquals(-9, roof.getMinZ()); | ||
} | ||
|
||
/** | ||
* Test method for {@link world.bentobox.greenhouses.greenhouse.Roof#getMaxZ()}. | ||
*/ | ||
@Ignore | ||
@Test | ||
public void testGetMaxZ() { | ||
fail("Not yet implemented"); // TODO | ||
} | ||
|
||
/** | ||
* Test method for {@link world.bentobox.greenhouses.greenhouse.Roof#setMaxZ(int)}. | ||
*/ | ||
@Ignore | ||
@Test | ||
public void testSetMaxZ() { | ||
fail("Not yet implemented"); // TODO | ||
assertEquals(29, roof.getMaxZ()); | ||
} | ||
|
||
/** | ||
* Test method for {@link world.bentobox.greenhouses.greenhouse.Roof#getArea()}. | ||
*/ | ||
@Ignore | ||
@Test | ||
public void testGetArea() { | ||
fail("Not yet implemented"); // TODO | ||
assertEquals(1406, roof.getArea()); | ||
} | ||
|
||
/** | ||
* Test method for {@link world.bentobox.greenhouses.greenhouse.Roof#isRoofFound()}. | ||
*/ | ||
@Ignore | ||
@Test | ||
public void testIsRoofFound() { | ||
fail("Not yet implemented"); // TODO | ||
assertTrue(roof.isRoofFound()); | ||
} | ||
|
||
/** | ||
* Test method for {@link world.bentobox.greenhouses.greenhouse.Roof#getHeight()}. | ||
*/ | ||
@Ignore | ||
@Test | ||
public void testGetHeight() { | ||
fail("Not yet implemented"); // TODO | ||
assertEquals(14, roof.getHeight()); | ||
} | ||
|
||
/** | ||
* Test method for {@link world.bentobox.greenhouses.greenhouse.Roof#getLocation()}. | ||
*/ | ||
@Ignore | ||
@Test | ||
public void testGetLocation() { | ||
fail("Not yet implemented"); // TODO | ||
assertEquals(location, roof.getLocation()); | ||
} | ||
|
||
/** | ||
* Test method for {@link world.bentobox.greenhouses.greenhouse.Roof#toString()}. | ||
*/ | ||
@Ignore | ||
@Test | ||
public void testToString() { | ||
fail("Not yet implemented"); // TODO | ||
assertTrue(roof.toString().endsWith("minX=-9, maxX=28, minZ=-9, maxZ=29, height=14, roofFound=true]")); | ||
} | ||
|
||
} |
Oops, something went wrong.