Test für Reiseplanung
parent
70836e2325
commit
f5fa33e182
|
@ -36,5 +36,6 @@
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
|
||||||
<classpathentry kind="output" path="target/classes"/>
|
<classpathentry kind="output" path="target/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
package domain;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class ReiseplanungTest {
|
||||||
|
|
||||||
|
Auto auto = new Auto("Brummi", 167.6);
|
||||||
|
Ort ort = new Ort(1067, "Dresden", 13.7210676148814, 51.0600336463379);
|
||||||
|
User user = new User("Karl", "hallo", ort, auto, 30, 15);
|
||||||
|
Ort ziel = new Ort(1705, "Freital", 13.6382950999229, 50.9981963286759);
|
||||||
|
Reiseplanung reise = new Reiseplanung(user,ziel);
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testBerechneEntfernung() {
|
||||||
|
|
||||||
|
double result = reise.berechneEntfernung(ort, ziel);
|
||||||
|
|
||||||
|
assertEquals(14.2125, result, 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testBerechneDauer() {
|
||||||
|
double entfernung = 136.5;
|
||||||
|
double geschwindigkeit = 70;
|
||||||
|
|
||||||
|
double result = reise.berechneDauer(entfernung, geschwindigkeit);
|
||||||
|
|
||||||
|
assertEquals(1.95, result, 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testBerechneCO2Ausstoß() {
|
||||||
|
double entfernung = 73.8;
|
||||||
|
|
||||||
|
double result = reise.berechneCO2Ausstoß(entfernung, auto);
|
||||||
|
|
||||||
|
assertEquals(12368.88, result, 0.0);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue