package ch.epfl.alpano; import static org.junit.Assert.*; import org.junit.Test; import ch.epfl.alpano.dem.ContinuousElevationModel; import ch.epfl.alpano.dem.ElevationProfile; public class PanoramaCompTest { @Test(expected = NullPointerException.class) public void throwsNullPointerUponConstruction(){ new PanoramaComputer(null); } @Test public void givesTrivialZero(){ double zero =PanoramaComputer.rayToGroundDistance( new ElevationProfile( new ContinuousElevationModel(new TestDemForPanoramaComp(new Interval2D(new Interval1D(-100, 100), new Interval1D(-100, 100)))), new GeoPoint(0,0),2.5,100), 0.0, 0.0).applyAsDouble( 1); assertEquals(0, zero,0.01); } @Test(expected = IllegalArgumentException.class) public void throwsIllegalArgumentExceptionOnNegValues(){ double zero =PanoramaComputer.rayToGroundDistance( new ElevationProfile( new ContinuousElevationModel(new TestDemForPanoramaComp(new Interval2D(new Interval1D(-100, 100), new Interval1D(-100, 100)))), new GeoPoint(0,0),0,100), 0.0, 1.0).applyAsDouble( -50); assertEquals(0, zero,0); } }