Browse Source

test constructor for code parameter

feature-pr-AirlineClass
Imron 3 years ago
parent
commit
556c18ebc0
  1. 10
      src/main/java/hs/fulda/de/ci/exam/project/Airline.java
  2. 5
      src/test/java/hs/fulda/de/ci/exam/project/AirlineTest.java

10
src/main/java/hs/fulda/de/ci/exam/project/Airline.java

@ -2,9 +2,11 @@ package hs.fulda.de.ci.exam.project;
public class Airline { public class Airline {
private String name; private String name;
private String code;
public Airline(String name, String code) { public Airline(String name, String code) {
this.name = name; this.name = name;
this.code = code;
} }
public String getName() { public String getName() {
@ -14,4 +16,12 @@ public class Airline {
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
} }

5
src/test/java/hs/fulda/de/ci/exam/project/AirlineTest.java

@ -14,4 +14,9 @@ public class AirlineTest {
Airline airline = new Airline("Pegasus", "1234"); Airline airline = new Airline("Pegasus", "1234");
assertThat(airline.getName()).describedAs("name of airline").isEqualTo("Pegasus"); assertThat(airline.getName()).describedAs("name of airline").isEqualTo("Pegasus");
} }
@Test
void testConstructorSetsCodeParameterCorrectly(){
Airline airline = new Airline("Pegasus", "1234");
assertThat(airline.getCode()).describedAs("code of airline").isEqualTo("1234");
}
} }
Loading…
Cancel
Save