Skip to content
Snippets Groups Projects
Commit 1bf5cd27 authored by User expired's avatar User expired
Browse files

added test for reachable bus stations (fixes todo in isochrone class)

parent 9178a571
No related branches found
No related tags found
No related merge requests found
package it.unibz.inf.isochrone.network;
import it.unibz.inf.isochrone.algorithm.MineX;
import it.unibz.inf.isochrone.config.ConfigDataset;
import it.unibz.inf.isochrone.network.AlgorithmHelper.AlgorithmResult;
import it.unibz.inf.isochrone.util.EnumContainer.Direction;
import it.unibz.inf.isochrone.util.EnumContainer.Mode;
import java.util.Calendar;
import java.util.Collection;
import java.util.GregorianCalendar;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
/**
* This checks if some well known isochrones are calculated the right way. Note
* that there is the possibility that one of the test fails due to changes in
* the network. So one should check for such changes (e.g. by visual isochrone
* comparison using a GUI), before fixing a broken test.
*/
public class ReachabilityTest {
private static final Logger LOGGER = LoggerFactory.getLogger(ReachabilityTest.class);
// local test parameters
private static final String DATASET = "bz";
private static final Double WALKING_SPEED = 1.0;
private static final int DURATION = 900;
private static final Calendar TIME = new GregorianCalendar(2011, 9, 14, 9, 0, 0);
private static final int STARTNODE_ID = 2000499; // FUB; Dominikanerplatz (also NodeID 2000500)
private static final Mode MODE = Mode.MULTIMODAL;
private static final Direction DIRECTION = Direction.INCOMING;
private static final TestParameters PARAM_LOCAL = new TestParameters(WALKING_SPEED, DURATION, TIME, MODE, STARTNODE_ID, DATASET, DIRECTION);
@BeforeClass
public void setup() {
LOGGER.info("Starting test(s) in class \"" + ReachabilityTest.class.getSimpleName() + "\"");
// loads dataset configurations (we do this before testing, so timings are correct)
ConfigDataset.getInstance(PARAM_LOCAL.getDataset());
}
@Test
public void testBzBusStation15() {
final int nodeIdToCheck = 5117; // bus station id = 5117; Defregger Str./Fagenstraße (reachable by bus route 1)
LOGGER.info("Checking nodes from FUB (15min isncoming isochrone)");
final AlgorithmResult result = AlgorithmHelper.run(MineX.class, PARAM_LOCAL, true);
final Collection<Node> resultNodes = result.getOutput().getNodes();
boolean foundNode = false;
for (final Node node : resultNodes) {
if (node.getId() == nodeIdToCheck) {
foundNode = true;
break;
}
}
Assert.assertTrue(foundNode, "Expected node not found in 15min incoming isochrone to FUB");
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment