From 2d25baa99a36cf885a093537dca5347cd3068c83 Mon Sep 17 00:00:00 2001 From: Imron Date: Mon, 24 Jan 2022 14:21:55 +0100 Subject: [PATCH] getFlights() --- .../hs/fulda/de/ci/exam/project/Airport.java | 7 +++++++ .../fulda/de/ci/exam/project/ExampleClass.java | 5 +++++ .../hs/fulda/de/ci/exam/project/Flight.java | 4 ++++ .../de/ci/exam/project/AirportClassTest.java | 12 ++++++++++++ .../fulda/de/ci/exam/project/ExampleClass.class | Bin 435 -> 865 bytes 5 files changed, 28 insertions(+) create mode 100644 src/main/java/hs/fulda/de/ci/exam/project/Flight.java diff --git a/src/main/java/hs/fulda/de/ci/exam/project/Airport.java b/src/main/java/hs/fulda/de/ci/exam/project/Airport.java index 75af1e7..673fcaa 100644 --- a/src/main/java/hs/fulda/de/ci/exam/project/Airport.java +++ b/src/main/java/hs/fulda/de/ci/exam/project/Airport.java @@ -1,8 +1,11 @@ package hs.fulda.de.ci.exam.project; +import java.util.LinkedList; + public class Airport { public Address address; + public LinkedList flights; protected String code; protected String name; @@ -17,4 +20,8 @@ public class Airport { public Address getAddress() { return this.address; } + + public LinkedList getFlights() { + return this.flights; + } } diff --git a/src/main/java/hs/fulda/de/ci/exam/project/ExampleClass.java b/src/main/java/hs/fulda/de/ci/exam/project/ExampleClass.java index 6969c70..10e23b9 100644 --- a/src/main/java/hs/fulda/de/ci/exam/project/ExampleClass.java +++ b/src/main/java/hs/fulda/de/ci/exam/project/ExampleClass.java @@ -4,5 +4,10 @@ import java.util.LinkedList; public class ExampleClass { public static void main(String[] args) { + LinkedList list = new LinkedList<>(); + list.add("heello"); + list.add("world"); + list.remove("heello"); + System.out.println(list); } } diff --git a/src/main/java/hs/fulda/de/ci/exam/project/Flight.java b/src/main/java/hs/fulda/de/ci/exam/project/Flight.java new file mode 100644 index 0000000..fc75e78 --- /dev/null +++ b/src/main/java/hs/fulda/de/ci/exam/project/Flight.java @@ -0,0 +1,4 @@ +package hs.fulda.de.ci.exam.project; + +public class Flight { +} diff --git a/src/test/java/hs/fulda/de/ci/exam/project/AirportClassTest.java b/src/test/java/hs/fulda/de/ci/exam/project/AirportClassTest.java index 38bc27e..f4b2f05 100644 --- a/src/test/java/hs/fulda/de/ci/exam/project/AirportClassTest.java +++ b/src/test/java/hs/fulda/de/ci/exam/project/AirportClassTest.java @@ -5,6 +5,8 @@ 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) @@ -33,6 +35,16 @@ public class AirportClassTest { assertThat(airport.getAddress()).describedAs("get address of airport").isEqualTo(address); } + @Test + void test_getFlights(){ + Airport airport = new Airport(); + LinkedList 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); + } + diff --git a/target/classes/hs/fulda/de/ci/exam/project/ExampleClass.class b/target/classes/hs/fulda/de/ci/exam/project/ExampleClass.class index 6818a520e7d530b565673646a0ef10930cbd208e..ecca17874d37e9ea9a7ebaedce8b30d0ae59482e 100644 GIT binary patch literal 865 zcma)4%Wl&^6g`udlVC`jGyw_$`U1y+4zOX7s+$T{79a(s0#=iFNT!VA$d5u-d=o5M z2_!y%k3!sui%200Y{~cDGjq;8bH_h^e*F&M2_9E*32h6vs>q>T#%&Ytl(AvrW(8Z= zu3`swE!?x(^oWT<&+DxaspP)4uBP!m%3!jaGe5h+ujgN0Z!HX<2>$K-#3**}RB84xo}iQmkKD&#L|_z7Ks z6ak&SF>iGdX0T>vlct+n+Hrslm_N@vIWRLJ`d*=mQ)Cp2?itwU`ErfEr3}Oh<@R~L ziaJ#lG_Xd9A%7yV9L1e)$h|&8-s{#2rzjqF>!mDEWgUJ&xqFI=5zoVjuai7rp-gX$ p1Y6{-P42d-m1)?@MA4)Sw5N@$xJE6nQ)SF#$U0>VHweq&<}Y*3#m)c# delta 189 zcmaFJwwYP<)W2Q(7#JAL8AP}km>C4w8HCswgeRJBnC#1_$i~9J%E+KGv0h{HJx1Yr z21N!Ypc)WhVqjzdN&-nXAWt7iGXiN=t?dkq8^O}-K#~n2$iM+)^FZ003|v4SCj&QF e1f*FTh(Ve$G_oUUWMtrF;N=6W