Refactored and updated to JUnit 5. Fixed biome selector.
This commit is contained in:
@@ -1,40 +1,23 @@
|
||||
package ca.recrown.islandsurvivalcraft;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestCase;
|
||||
import junit.framework.TestSuite;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.TestInstance;
|
||||
import org.junit.jupiter.api.TestInstance.Lifecycle;
|
||||
|
||||
/**
|
||||
* Unit test for simple App.
|
||||
*/
|
||||
public class UtilitiesTest
|
||||
extends TestCase
|
||||
{
|
||||
/**
|
||||
* Create the test case
|
||||
*
|
||||
* @param testName name of the test case
|
||||
*/
|
||||
public UtilitiesTest( String testName )
|
||||
{
|
||||
super( testName );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the suite of tests being tested
|
||||
*/
|
||||
public static Test suite()
|
||||
{
|
||||
return new TestSuite( UtilitiesTest.class );
|
||||
}
|
||||
|
||||
@TestInstance(Lifecycle.PER_CLASS)
|
||||
public class UtilitiesTest {
|
||||
/**
|
||||
* Basic hashmap inversion test.
|
||||
*/
|
||||
@Test
|
||||
public void testInvertHashMap()
|
||||
{
|
||||
HashMap<String, Integer> hashMap = new HashMap<>();
|
||||
|
@@ -1,14 +1,19 @@
|
||||
package ca.recrown.islandsurvivalcraft.pathfinding;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestCase;
|
||||
import junit.framework.TestSuite;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.TestInstance;
|
||||
import org.junit.jupiter.api.TestInstance.Lifecycle;
|
||||
|
||||
|
||||
/**
|
||||
* Unit test for simple App.
|
||||
*/
|
||||
public class DepthFirstSearchTest extends TestCase
|
||||
{
|
||||
@TestInstance(Lifecycle.PER_CLASS)
|
||||
public class DepthFirstSearchTest {
|
||||
|
||||
private class Validator implements CoordinateValidatable {
|
||||
private boolean[][] map;
|
||||
@@ -59,29 +64,11 @@ public class DepthFirstSearchTest extends TestCase
|
||||
{true, false, false, false},
|
||||
};
|
||||
|
||||
/**
|
||||
* Create the test case
|
||||
*
|
||||
* @param testName name of the test case
|
||||
*/
|
||||
public DepthFirstSearchTest( String testName )
|
||||
{
|
||||
super( testName );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the suite of tests being tested
|
||||
*/
|
||||
public static Test suite()
|
||||
{
|
||||
return new TestSuite( DepthFirstSearchTest.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
@BeforeAll
|
||||
protected void setUp() {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDFSMapAValid()
|
||||
{
|
||||
DepthFirstSearch dfs = new DepthFirstSearch(new Validator(mapA));
|
||||
@@ -89,6 +76,7 @@ public class DepthFirstSearchTest extends TestCase
|
||||
assertTrue(dfs.buildTree());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDFSMapBValid()
|
||||
{
|
||||
DepthFirstSearch dfs = new DepthFirstSearch(new Validator(mapB));
|
||||
@@ -96,6 +84,7 @@ public class DepthFirstSearchTest extends TestCase
|
||||
assertTrue(dfs.buildTree());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDFSMapDValid()
|
||||
{
|
||||
DepthFirstSearch dfs = new DepthFirstSearch(new Validator(mapD));
|
||||
@@ -103,6 +92,7 @@ public class DepthFirstSearchTest extends TestCase
|
||||
assertTrue(dfs.buildTree());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDFSMapCInvalid()
|
||||
{
|
||||
DepthFirstSearch dfs = new DepthFirstSearch(new Validator(mapC));
|
||||
@@ -110,6 +100,7 @@ public class DepthFirstSearchTest extends TestCase
|
||||
assertFalse(dfs.buildTree());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDFSMapEInvalid()
|
||||
{
|
||||
DepthFirstSearch dfs = new DepthFirstSearch(new Validator(mapE));
|
||||
|
Reference in New Issue
Block a user