From e9eac5a2e8e69e25207d472f0c9efd97537d8970 Mon Sep 17 00:00:00 2001 From: Imron Date: Mon, 24 Jan 2022 14:09:55 +0100 Subject: [PATCH] getAddresses() --- .../hs/fulda/de/ci/exam/project/Address.java | 6 ++++++ .../hs/fulda/de/ci/exam/project/Airport.java | 5 +++++ .../de/ci/exam/project/AirportClassTest.java | 20 +++++++++++++++++- .../de/ci/exam/project/ExampleClass.class | Bin 865 -> 435 bytes 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 src/main/java/hs/fulda/de/ci/exam/project/Address.java diff --git a/src/main/java/hs/fulda/de/ci/exam/project/Address.java b/src/main/java/hs/fulda/de/ci/exam/project/Address.java new file mode 100644 index 0000000..86898aa --- /dev/null +++ b/src/main/java/hs/fulda/de/ci/exam/project/Address.java @@ -0,0 +1,6 @@ +package hs.fulda.de.ci.exam.project; + +public class Address { + public Address(String streetAddress, String city, String state, String zipCode, String country) { + } +} 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 03173a0..75af1e7 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 @@ -2,6 +2,7 @@ package hs.fulda.de.ci.exam.project; public class Airport { + public Address address; protected String code; protected String name; @@ -12,4 +13,8 @@ public class Airport { public String getCode() { return this.code; } + + public Address getAddress() { + return this.address; + } } 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 101063d..38bc27e 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 @@ -1,10 +1,16 @@ package hs.fulda.de.ci.exam.project; import org.junit.jupiter.api.Test; -import static org.assertj.core.api.Assertions.assertThat; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import static org.assertj.core.api.Assertions.*; +@ExtendWith(MockitoExtension.class) public class AirportClassTest { + + @Test void test_getName(){ Airport airport = new Airport(); @@ -19,4 +25,16 @@ public class AirportClassTest { 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); + } + + + + + } 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 ecca17874d37e9ea9a7ebaedce8b30d0ae59482e..6818a520e7d530b565673646a0ef10930cbd208e 100644 GIT binary patch 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=6Wq>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#