package ch.epfl.isochrone.timetable;

import java.util.HashSet;
import java.util.Set;

import org.junit.Ignore;
import org.junit.Test;

import ch.epfl.isochrone.geo.PointWGS84;

public class TestGraph {
    // Le "test" suivant n'en est pas un à proprement parler, raison pour
    // laquelle il est ignoré (annotation @Ignore). Son seul but est de garantir
    // que les noms des classes et méthodes sont corrects.
    @Test
    @Ignore
    public void namesAreOk() {
        // Graph n'a aucune méthode publique à ce stade...

        Set<Stop> stops = null;
        Stop stop = null;
        Graph.Builder gb = new Graph.Builder(stops);
        gb.addTripEdge(stop, stop, 0, 0);
        gb.addAllWalkEdges(0, 0);
        gb.build();
    }

    @Test(expected = IllegalArgumentException.class)
    public void builderExceptionNotContainsStop() {

        Set<Stop> stops = new HashSet<Stop>();
        Stop stop = new Stop("test", new PointWGS84(0.1, 0.1));
        Graph.Builder gb = new Graph.Builder(stops);
        gb.addTripEdge(stop, stop, 0, 0);
    }

    @Test(expected = IllegalArgumentException.class)
    public void builderExceptionNegativeDepartureTime() {

        Set<Stop> stops = new HashSet<Stop>();
        Stop stop = new Stop("test", new PointWGS84(0.1, 0.1));
        stops.add(stop);
        Graph.Builder gb = new Graph.Builder(stops);
        gb.addTripEdge(stop, stop, -10, 0);
    }

    @Test(expected = IllegalArgumentException.class)
    public void builderExceptionNegativeArrivalTime() {

        Set<Stop> stops = new HashSet<Stop>();
        Stop stop = new Stop("test", new PointWGS84(0.1, 0.1));
        stops.add(stop);
        Graph.Builder gb = new Graph.Builder(stops);
        gb.addTripEdge(stop, stop, 0, -10);
    }

    @Test(expected = IllegalArgumentException.class)
    public void builderExceptionNegativeDurationTime() {

        Set<Stop> stops = new HashSet<Stop>();
        Stop stop = new Stop("test", new PointWGS84(0.1, 0.1));
        stops.add(stop);
        Graph.Builder gb = new Graph.Builder(stops);
        gb.addTripEdge(stop, stop, 10, 5);
    }
}
