From 556c18ebc033e06aa88659ad4379103a30a00c2e Mon Sep 17 00:00:00 2001 From: Imron Date: Sun, 30 Jan 2022 19:26:47 +0100 Subject: [PATCH] test constructor for code parameter --- src/main/java/hs/fulda/de/ci/exam/project/Airline.java | 10 ++++++++++ .../java/hs/fulda/de/ci/exam/project/AirlineTest.java | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/src/main/java/hs/fulda/de/ci/exam/project/Airline.java b/src/main/java/hs/fulda/de/ci/exam/project/Airline.java index fb48233..aa9d0fb 100644 --- a/src/main/java/hs/fulda/de/ci/exam/project/Airline.java +++ b/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 { private String name; + private String code; public Airline(String name, String code) { this.name = name; + this.code = code; } public String getName() { @@ -14,4 +16,12 @@ public class Airline { public void setName(String name) { this.name = name; } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } } diff --git a/src/test/java/hs/fulda/de/ci/exam/project/AirlineTest.java b/src/test/java/hs/fulda/de/ci/exam/project/AirlineTest.java index cc81361..e4ee951 100644 --- a/src/test/java/hs/fulda/de/ci/exam/project/AirlineTest.java +++ b/src/test/java/hs/fulda/de/ci/exam/project/AirlineTest.java @@ -14,4 +14,9 @@ public class AirlineTest { Airline airline = new Airline("Pegasus", "1234"); 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"); + } }