Imron
3 years ago
11 changed files with 167 additions and 78 deletions
-
22src/main/java/hs/fulda/de/ci/exam/project/Address.java
-
15src/main/java/hs/fulda/de/ci/exam/project/Airport.java
-
13src/main/java/hs/fulda/de/ci/exam/project/ExampleClass.java
-
43src/main/java/hs/fulda/de/ci/exam/project/Flight.java
-
4src/main/java/hs/fulda/de/ci/exam/project/FlightInstance.java
-
52src/test/java/hs/fulda/de/ci/exam/project/AirportClassTest.java
-
49src/test/java/hs/fulda/de/ci/exam/project/AirportTest.java
-
11src/test/java/hs/fulda/de/ci/exam/project/ExampleClassTest.java
-
36src/test/java/hs/fulda/de/ci/exam/project/FlightTest.java
-
BINtarget/classes/hs/fulda/de/ci/exam/project/ExampleClass.class
-
BINtarget/test-classes/hs/fulda/de/ci/exam/project/ExampleClassTest.class
@ -1,6 +1,28 @@ |
|||
package hs.fulda.de.ci.exam.project; |
|||
|
|||
public class Address { |
|||
String streetAddress; |
|||
String city; |
|||
String state; |
|||
String zipCode; |
|||
String country; |
|||
|
|||
public Address(String streetAddress, String city, String state, String zipCode, String country) { |
|||
this.streetAddress = streetAddress; |
|||
this.city = city; |
|||
this.state = state; |
|||
this.zipCode = zipCode; |
|||
this.country = country; |
|||
} |
|||
|
|||
@Override |
|||
public String toString() { |
|||
return "Address{" + |
|||
"streetAddress='" + streetAddress + '\'' + |
|||
", city='" + city + '\'' + |
|||
", state='" + state + '\'' + |
|||
", zipCode='" + zipCode + '\'' + |
|||
", country='" + country + '\'' + |
|||
'}'; |
|||
} |
|||
} |
@ -1,13 +0,0 @@ |
|||
package hs.fulda.de.ci.exam.project; |
|||
|
|||
import java.util.LinkedList; |
|||
|
|||
public class ExampleClass { |
|||
public static void main(String[] args) { |
|||
LinkedList<String> list = new LinkedList<>(); |
|||
list.add("heello"); |
|||
list.add("world"); |
|||
list.remove("heello"); |
|||
System.out.println(list); |
|||
} |
|||
} |
@ -1,4 +1,47 @@ |
|||
package hs.fulda.de.ci.exam.project; |
|||
|
|||
import java.util.LinkedList; |
|||
|
|||
public class Flight { |
|||
String flightNumber; |
|||
Airport departure; |
|||
Airport arrival; |
|||
int durationInMinutes; |
|||
LinkedList<FlightInstance> flightInstances; |
|||
|
|||
public Flight(String flightNumber, Airport departure, Airport arrival, int durationInMinutes) { |
|||
this.flightNumber = flightNumber; |
|||
this.departure = departure; |
|||
this.arrival = arrival; |
|||
this.durationInMinutes = durationInMinutes; |
|||
} |
|||
|
|||
public LinkedList<FlightInstance> getInstances() { |
|||
return this.flightInstances; |
|||
} |
|||
|
|||
public boolean cancel() { |
|||
return true; |
|||
} |
|||
|
|||
public boolean addFlightSchedule() { |
|||
return true; |
|||
} |
|||
|
|||
public String getFlightNumber() { |
|||
return flightNumber; |
|||
} |
|||
|
|||
public Airport getDeparture() { |
|||
return departure; |
|||
} |
|||
|
|||
public Airport getArrival() { |
|||
return arrival; |
|||
} |
|||
|
|||
public int getDurationInMinutes() { |
|||
return durationInMinutes; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,4 @@ |
|||
package hs.fulda.de.ci.exam.project; |
|||
|
|||
public class FlightInstance { |
|||
} |
@ -1,52 +0,0 @@ |
|||
package hs.fulda.de.ci.exam.project; |
|||
|
|||
import org.junit.jupiter.api.Test; |
|||
import org.junit.jupiter.api.extension.ExtendWith; |
|||
import org.mockito.Mock; |
|||
import org.mockito.junit.jupiter.MockitoExtension; |
|||
|
|||
import java.util.LinkedList; |
|||
|
|||
import static org.assertj.core.api.Assertions.*; |
|||
|
|||
@ExtendWith(MockitoExtension.class) |
|||
public class AirportClassTest { |
|||
|
|||
|
|||
@Test |
|||
void test_getName(){ |
|||
Airport airport = new Airport(); |
|||
airport.name = "fraport"; |
|||
assertThat(airport.getName()).describedAs("get airport name").isEqualTo("fraport"); |
|||
} |
|||
|
|||
@Test |
|||
void test_getCode(){ |
|||
Airport airport = new Airport(); |
|||
airport.code = "PC994"; |
|||
assertThat(airport.getCode()).describedAs("get airport code").isEqualTo("PC994"); |
|||
} |
|||
|
|||
@Test |
|||
void test_getAddress(){ |
|||
Airport airport = new Airport(); |
|||
Address address = new Address("Mittelstr", "Fulda", "Hessen", "36037", "Germany"); |
|||
airport.address = address; |
|||
assertThat(airport.getAddress()).describedAs("get address of airport").isEqualTo(address); |
|||
} |
|||
|
|||
@Test |
|||
void test_getFlights(){ |
|||
Airport airport = new Airport(); |
|||
LinkedList<Flight> flights = new LinkedList<>(); |
|||
Flight flight1 = new Flight(); |
|||
flights.add(flight1); |
|||
airport.flights = flights; |
|||
assertThat(airport.getFlights()).describedAs("get all flights of the airport").isEqualTo(flights); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,49 @@ |
|||
package hs.fulda.de.ci.exam.project; |
|||
|
|||
import org.junit.jupiter.api.Test; |
|||
import org.junit.jupiter.api.extension.ExtendWith; |
|||
import org.mockito.junit.jupiter.MockitoExtension; |
|||
|
|||
import java.util.LinkedList; |
|||
|
|||
import static org.assertj.core.api.Assertions.*; |
|||
|
|||
@ExtendWith(MockitoExtension.class) |
|||
public class AirportTest { |
|||
|
|||
Address address_fr = new Address("Frankfurt str", "Frankfurt", "Hessen", "63023", "Germany"); |
|||
Airport airport_fr = new Airport("Fraport", address_fr, "1234"); |
|||
|
|||
|
|||
Address address1_ist = new Address("Istanbul str", "Istanbul", "Fatih", "9019", "Turkey"); |
|||
Airport airport1_ist = new Airport("Istanbul", address1_ist, "5678"); |
|||
|
|||
Flight flight1 = new Flight("1", airport_fr, airport1_ist, 140); |
|||
Flight flight2 = new Flight("2", airport1_ist, airport_fr, 120); |
|||
|
|||
|
|||
@Test |
|||
void test_getName() { |
|||
assertThat(airport_fr.getName()).describedAs("get airport name").isEqualTo("Fraport"); |
|||
} |
|||
|
|||
@Test |
|||
void test_getCode() { |
|||
assertThat(airport_fr.getCode()).describedAs("get airport code").isEqualTo("1234"); |
|||
} |
|||
|
|||
@Test |
|||
void test_getAddress() { |
|||
assertThat(airport_fr.getAddress()).describedAs("get address of airport").isEqualTo(address_fr); |
|||
} |
|||
|
|||
@Test |
|||
void test_getFlights() { |
|||
LinkedList<Flight> flist = new LinkedList<>(); |
|||
flist.add(flight1); |
|||
|
|||
airport_fr.flights.add(flight1); |
|||
|
|||
assertThat(airport_fr.getFlights()).describedAs("get all flights of the airport").isEqualTo(flist); |
|||
} |
|||
} |
@ -1,11 +0,0 @@ |
|||
package hs.fulda.de.ci.exam.project; |
|||
|
|||
import org.junit.jupiter.api.Test; |
|||
import static org.junit.jupiter.api.Assertions.*; |
|||
|
|||
public class ExampleClassTest { |
|||
@Test |
|||
void testExampleClass() { |
|||
assertTrue(true); |
|||
} |
|||
} |
@ -0,0 +1,36 @@ |
|||
package hs.fulda.de.ci.exam.project; |
|||
|
|||
import org.junit.jupiter.api.Test; |
|||
|
|||
import static org.junit.jupiter.api.Assertions.*; |
|||
|
|||
class FlightTest { |
|||
|
|||
@Test |
|||
void getInstances() { |
|||
} |
|||
|
|||
@Test |
|||
void cancel() { |
|||
} |
|||
|
|||
@Test |
|||
void addFlightSchedule() { |
|||
} |
|||
|
|||
@Test |
|||
void getFlightNumber() { |
|||
} |
|||
|
|||
@Test |
|||
void getDeparture() { |
|||
} |
|||
|
|||
@Test |
|||
void getArrival() { |
|||
} |
|||
|
|||
@Test |
|||
void getDurationInMinutes() { |
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue