Switched to java 8, added ground factory

This commit is contained in:
Ziver Koc 2020-01-04 00:01:45 +01:00
parent a3503e3e5c
commit c51a473120
14 changed files with 154 additions and 25 deletions

View 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);
});
}
}

View file

@ -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));
}
}

View file

@ -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() {
}
}