Fixed init of grounds and fixed tests.
This commit is contained in:
parent
3b9422346a
commit
f8353d4354
14 changed files with 178 additions and 96 deletions
37
core/test/se/cookery/world/BlockTest.java
Normal file
37
core/test/se/cookery/world/BlockTest.java
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
package se.cookery.world;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class BlockTest {
|
||||
|
||||
@Test
|
||||
void getBlockStartX() {
|
||||
Block block = new Block(0, 0);
|
||||
assertEquals(0, block.getBlockStartX());
|
||||
assertEquals(0, block.getBlockStartY());
|
||||
assertEquals(19, block.getBlockEndX());
|
||||
assertEquals(19, block.getBlockEndY());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getBlockStartY() {
|
||||
}
|
||||
|
||||
@Test
|
||||
void getLocalX() {
|
||||
}
|
||||
|
||||
@Test
|
||||
void getLocalY() {
|
||||
}
|
||||
|
||||
@Test
|
||||
void getHeight() {
|
||||
}
|
||||
|
||||
@Test
|
||||
void getGroundType() {
|
||||
}
|
||||
}
|
||||
|
|
@ -1,29 +1,36 @@
|
|||
package se.cookery.world;
|
||||
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.security.InvalidParameterException;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class GroundTypeFactoryTest {
|
||||
class GroundTypeManagerTest {
|
||||
|
||||
@BeforeAll
|
||||
public static void initialize() throws IOException {
|
||||
GroundTypeManager.initialize();
|
||||
}
|
||||
|
||||
@Test
|
||||
void invalidIDTest() {
|
||||
assertThrows(InvalidParameterException.class, () -> {
|
||||
GroundTypeFactory.get(-1);
|
||||
GroundTypeManager.get(-1);
|
||||
});
|
||||
|
||||
assertThrows(InvalidParameterException.class, () -> {
|
||||
GroundTypeFactory.get(500);
|
||||
GroundTypeManager.get(500);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void get() {
|
||||
GroundType ground = GroundTypeFactory.get(0);
|
||||
GroundType ground = GroundTypeManager.get(0);
|
||||
assertNotNull(ground);
|
||||
assertSame(ground, GroundTypeFactory.get(0));
|
||||
assertSame(ground, GroundTypeManager.get(0));
|
||||
assertEquals("Grass", ground.getName());
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue