package fileHandling;
import static org.junit.Assert.*;
import java.util.List;
import map.Map;
import map.infos.CommonInfos;
import map.infos.TeamInfos;
import org.junit.Test;
public class ScenarioLoaderTest {
private static final String SCENARIO_NAME = "fastscenario";
@Test
public void testFindScenarios() {
List<String> scenarios = MapLoader.findMaps();
assertNotNull("Found Scenarios should not be null", scenarios);
assertTrue("Found Scenarios should not be empty", !scenarios.isEmpty());
}
@Test
public void testScenarioLoading() {
Map scen = MapLoader.createMap(SCENARIO_NAME);
assertTrue("The Scenario should not be null", scen != null);
scen = MapLoader.createMap("bla");
assertTrue("The Scenario should be null", scen == null);
}
@Test
public void testTeamInfosLoading() {
TeamInfos teamInfos = MapLoader.getTeamInfos(SCENARIO_NAME, 1);
assertNotNull("TeamInfos should not be null", teamInfos);
teamInfos = MapLoader.getTeamInfos(SCENARIO_NAME, 2);
assertNotNull("TeamInfos should not be null", teamInfos);
teamInfos = MapLoader.getTeamInfos("", 2);
assertNull("TeamInfos should be null", teamInfos);
teamInfos = MapLoader.getTeamInfos(SCENARIO_NAME, 0);
assertNull("TeamInfos should be null", teamInfos);
teamInfos = MapLoader.getTeamInfos(SCENARIO_NAME, 3);
assertNull("TeamInfos should be null", teamInfos);
}
@Test
public void testCommonInfosLoading() {
CommonInfos commonInfos = MapLoader.getCommonInfos(SCENARIO_NAME);
assertNotNull("CommonInfos should not be null", commonInfos);
commonInfos = MapLoader.getCommonInfos("bla");
assertNull("CommonInfos should be null", commonInfos);
}
}
|