Browse Source

getAddresses()

feature-pr-AirportClass
Imron 3 years ago
parent
commit
e9eac5a2e8
  1. 6
      src/main/java/hs/fulda/de/ci/exam/project/Address.java
  2. 5
      src/main/java/hs/fulda/de/ci/exam/project/Airport.java
  3. 20
      src/test/java/hs/fulda/de/ci/exam/project/AirportClassTest.java
  4. BIN
      target/classes/hs/fulda/de/ci/exam/project/ExampleClass.class

6
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) {
}
}

5
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 class Airport {
public Address address;
protected String code; protected String code;
protected String name; protected String name;
@ -12,4 +13,8 @@ public class Airport {
public String getCode() { public String getCode() {
return this.code; return this.code;
} }
public Address getAddress() {
return this.address;
}
} }

20
src/test/java/hs/fulda/de/ci/exam/project/AirportClassTest.java

@ -1,10 +1,16 @@
package hs.fulda.de.ci.exam.project; package hs.fulda.de.ci.exam.project;
import org.junit.jupiter.api.Test; 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 { public class AirportClassTest {
@Test @Test
void test_getName(){ void test_getName(){
Airport airport = new Airport(); Airport airport = new Airport();
@ -19,4 +25,16 @@ public class AirportClassTest {
assertThat(airport.getCode()).describedAs("get airport code").isEqualTo("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);
}
} }

BIN
target/classes/hs/fulda/de/ci/exam/project/ExampleClass.class

Loading…
Cancel
Save