diff --git a/pom.xml b/pom.xml index d3f05d5..1841d9b 100644 --- a/pom.xml +++ b/pom.xml @@ -50,6 +50,12 @@ ${mockito.version} test + + junit + junit + 4.8.2 + test + 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 new file mode 100644 index 0000000..1a85b40 --- /dev/null +++ b/src/main/java/hs/fulda/de/ci/exam/project/Airline.java @@ -0,0 +1,39 @@ +package hs.fulda.de.ci.exam.project; + +import java.util.HashSet; + +public class Airline { + private String name; + private String code; + private HashSet flights; + + public Airline(String name, String code) { + this.name = name; + this.code = code; + this.flights = new HashSet<>(); + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public HashSet getFlights() { + return flights; + } + + public void addFlight(Flight flight) { + flights.add(flight); + } +} 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 new file mode 100644 index 0000000..4777567 --- /dev/null +++ b/src/test/java/hs/fulda/de/ci/exam/project/AirlineTest.java @@ -0,0 +1,51 @@ +package hs.fulda.de.ci.exam.project; + +import org.junit.jupiter.api.Test; +import org.junit.runner.RunWith; +import org.mockito.junit.MockitoJUnitRunner; + +import java.util.HashSet; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.mock; + +@RunWith(MockitoJUnitRunner.class) +public class AirlineTest { + + Airline airline = new Airline("Pegasus", "1234"); + Flight flight1 = mock(Flight.class); + HashSet flights = new HashSet<>(); + + @Test + void testConstructorSetsNameParameterCorrectly() { + assertThat(airline.getName()) + .describedAs("name of airline") + .isEqualTo("Pegasus"); + } + + @Test + void testConstructorSetsCodeParameterCorrectly() { + assertThat(airline.getCode()) + .describedAs("code of airline") + .isEqualTo("1234"); + } + + @Test + void getFlightsReturnsEmptyListOfFlights() { + assertThat(airline.getFlights()) + .describedAs("flights of airline") + .isEqualTo(flights); + } + + @Test + void addFlightAddsFlightToListOfFlights() { + flights.add(flight1); + + airline.addFlight(flight1); + + assertThat(airline.getFlights()) + .describedAs("flights of airline") + .isEqualTo(flights); + } + +} diff --git a/target/AirlineManagementSystem-1.0-SNAPSHOT.jar b/target/AirlineManagementSystem-1.0-SNAPSHOT.jar index 345bef8..f166720 100644 Binary files a/target/AirlineManagementSystem-1.0-SNAPSHOT.jar and b/target/AirlineManagementSystem-1.0-SNAPSHOT.jar differ diff --git a/target/classes/hs/fulda/de/ci/exam/project/Person.class b/target/classes/hs/fulda/de/ci/exam/project/Person.class index 4407f72..79140f2 100644 Binary files a/target/classes/hs/fulda/de/ci/exam/project/Person.class and b/target/classes/hs/fulda/de/ci/exam/project/Person.class differ diff --git a/target/maven-archiver/pom.properties b/target/maven-archiver/pom.properties index 72e7601..ca0dfcb 100644 --- a/target/maven-archiver/pom.properties +++ b/target/maven-archiver/pom.properties @@ -1,5 +1,5 @@ #Generated by Maven -#Mon Jan 24 12:13:24 CET 2022 +#Sat Jan 29 15:33:12 CET 2022 groupId=hs.fulda.de.ci.exam.project artifactId=AirlineManagementSystem version=1.0-SNAPSHOT diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst index 4146c73..e6d23e5 100644 --- a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -1 +1,4 @@ -hs/fulda/de/ci/exam/project/ExampleClass.class +hs/fulda/de/ci/exam/project/FlightInstance.class +hs/fulda/de/ci/exam/project/Airport.class +hs/fulda/de/ci/exam/project/Address.class +hs/fulda/de/ci/exam/project/Flight.class diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst index 764d565..eadb9ed 100644 --- a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -1 +1,4 @@ -/Users/imron/OneDrive - lt.hs-fulda.de/Desktop/Semester_7_HSF/CI/AirlineManagementSystem/src/main/java/hs/fulda/de/ci/exam/project/ExampleClass.java +/Users/imron/Library/CloudStorage/OneDrive-lt.hs-fulda.de/Desktop/Semester_7_HSF/CI/AirlineManagementSystem/src/main/java/hs/fulda/de/ci/exam/project/Airport.java +/Users/imron/Library/CloudStorage/OneDrive-lt.hs-fulda.de/Desktop/Semester_7_HSF/CI/AirlineManagementSystem/src/main/java/hs/fulda/de/ci/exam/project/Address.java +/Users/imron/Library/CloudStorage/OneDrive-lt.hs-fulda.de/Desktop/Semester_7_HSF/CI/AirlineManagementSystem/src/main/java/hs/fulda/de/ci/exam/project/FlightInstance.java +/Users/imron/Library/CloudStorage/OneDrive-lt.hs-fulda.de/Desktop/Semester_7_HSF/CI/AirlineManagementSystem/src/main/java/hs/fulda/de/ci/exam/project/Flight.java diff --git a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst index 2a3e81d..c17a6a7 100644 --- a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst +++ b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst @@ -1 +1,3 @@ -hs/fulda/de/ci/exam/project/ExampleClassTest.class +hs/fulda/de/ci/exam/project/AddressTest.class +hs/fulda/de/ci/exam/project/FlightTest.class +hs/fulda/de/ci/exam/project/AirportTest.class diff --git a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst index 09bf98c..f230483 100644 --- a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst +++ b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst @@ -1,2 +1,3 @@ -/Users/imron/OneDrive - lt.hs-fulda.de/Desktop/Semester_7_HSF/CI/AirlineManagementSystem/src/test/java/hs/fulda/de/ci/exam/project/ExampleClassTest.java -/Users/imron/OneDrive - lt.hs-fulda.de/Desktop/Semester_7_HSF/CI/AirlineManagementSystem/src/test/java/TestExample.java +/Users/imron/Library/CloudStorage/OneDrive-lt.hs-fulda.de/Desktop/Semester_7_HSF/CI/AirlineManagementSystem/src/test/java/hs/fulda/de/ci/exam/project/FlightTest.java +/Users/imron/Library/CloudStorage/OneDrive-lt.hs-fulda.de/Desktop/Semester_7_HSF/CI/AirlineManagementSystem/src/test/java/hs/fulda/de/ci/exam/project/AirportTest.java +/Users/imron/Library/CloudStorage/OneDrive-lt.hs-fulda.de/Desktop/Semester_7_HSF/CI/AirlineManagementSystem/src/test/java/hs/fulda/de/ci/exam/project/AddressTest.java diff --git a/target/surefire-reports/TEST-TestExample.xml b/target/surefire-reports/TEST-TestExample.xml deleted file mode 100644 index 38e33bc..0000000 --- a/target/surefire-reports/TEST-TestExample.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/target/surefire-reports/TEST-hs.fulda.de.ci.exam.project.ExampleClassTest.xml b/target/surefire-reports/TEST-hs.fulda.de.ci.exam.project.ExampleClassTest.xml deleted file mode 100644 index bbddb48..0000000 --- a/target/surefire-reports/TEST-hs.fulda.de.ci.exam.project.ExampleClassTest.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/target/surefire-reports/TEST-hs.fulda.de.ci.exam.project.TestExampleClass.xml b/target/surefire-reports/TEST-hs.fulda.de.ci.exam.project.TestExampleClass.xml deleted file mode 100644 index 692684a..0000000 --- a/target/surefire-reports/TEST-hs.fulda.de.ci.exam.project.TestExampleClass.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/target/surefire-reports/TestExample.txt b/target/surefire-reports/TestExample.txt deleted file mode 100644 index 0f318c5..0000000 --- a/target/surefire-reports/TestExample.txt +++ /dev/null @@ -1,4 +0,0 @@ -------------------------------------------------------------------------------- -Test set: TestExample -------------------------------------------------------------------------------- -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 s - in TestExample diff --git a/target/surefire-reports/hs.fulda.de.ci.exam.project.ExampleClassTest.txt b/target/surefire-reports/hs.fulda.de.ci.exam.project.ExampleClassTest.txt deleted file mode 100644 index 3da405b..0000000 --- a/target/surefire-reports/hs.fulda.de.ci.exam.project.ExampleClassTest.txt +++ /dev/null @@ -1,4 +0,0 @@ -------------------------------------------------------------------------------- -Test set: hs.fulda.de.ci.exam.project.ExampleClassTest -------------------------------------------------------------------------------- -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.017 s - in hs.fulda.de.ci.exam.project.ExampleClassTest diff --git a/target/surefire-reports/hs.fulda.de.ci.exam.project.TestExampleClass.txt b/target/surefire-reports/hs.fulda.de.ci.exam.project.TestExampleClass.txt deleted file mode 100644 index b805685..0000000 --- a/target/surefire-reports/hs.fulda.de.ci.exam.project.TestExampleClass.txt +++ /dev/null @@ -1,4 +0,0 @@ -------------------------------------------------------------------------------- -Test set: hs.fulda.de.ci.exam.project.TestExampleClass -------------------------------------------------------------------------------- -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.023 s - in hs.fulda.de.ci.exam.project.TestExampleClass diff --git a/target/test-classes/hs/fulda/de/ci/exam/project/PersonTest.class b/target/test-classes/hs/fulda/de/ci/exam/project/PersonTest.class index cdb369d..3f5b4f6 100644 Binary files a/target/test-classes/hs/fulda/de/ci/exam/project/PersonTest.class and b/target/test-classes/hs/fulda/de/ci/exam/project/PersonTest.class differ