Switched to java 8, added ground factory
This commit is contained in:
parent
a3503e3e5c
commit
c51a473120
14 changed files with 154 additions and 25 deletions
21
core/test/se/cookery/world/GroundFactoryTest.java
Normal file
21
core/test/se/cookery/world/GroundFactoryTest.java
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
package se.cookery.world;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class GroundFactoryTest {
|
||||
|
||||
@Test
|
||||
void get() {
|
||||
assertThrows(InvalidParameterException.class, () -> {
|
||||
GroundFactory.get(-1);
|
||||
});
|
||||
|
||||
assertThrows(InvalidParameterException.class, () -> {
|
||||
GroundFactory.get(500);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +1,27 @@
|
|||
package se.cookery.world;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import se.cookery.world.gen.GrassLandWorldGenerator;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
public class WorldTest {
|
||||
|
||||
@Test
|
||||
public void blockExists() {
|
||||
World w = new World();
|
||||
assertNull(w.getBlock(0, 0));
|
||||
World w = new World(new GrassLandWorldGenerator());
|
||||
assertFalse(w.blockExists(0, 0));
|
||||
assertFalse(w.blockExists(Long.MAX_VALUE, Long.MAX_VALUE));
|
||||
assertFalse(w.blockExists(Long.MIN_VALUE, Long.MAX_VALUE));
|
||||
assertFalse(w.blockExists(Long.MAX_VALUE, Long.MIN_VALUE));
|
||||
assertFalse(w.blockExists(Long.MIN_VALUE, Long.MIN_VALUE));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getBlock() {
|
||||
World w = new World(new GrassLandWorldGenerator());
|
||||
assertFalse(w.blockExists(0, 0));
|
||||
assertNotNull(w.getBlock(0,0));
|
||||
assertTrue(w.blockExists(0, 0));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package se.cookery.world.gen;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class GrassLandWorldGeneratorTest {
|
||||
|
||||
@Test
|
||||
void generateBlock() {
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue