Skip to content

FlightTest Documentation

Hailey Fritz edited this page Nov 21, 2023 · 6 revisions

Overview

The FlightTest class is a test class for the Flight class, using the JUnit frameworks for testing.

Class-Level

  • The FlightTest class is called via the Test Suite Class Test Suite and therefore requires no individual instance for the required functionality. The below code showcases how the FlightTest class is referenced and utilized:
@RunWith(Suite.class)
@Suite.SuiteClasses({
      LuggageManagementSystemTest.class,
      PassengerTest.class,
      LuggageSlipTest.class,
      LuggageManifestTest.class,
      FlightTest.class
})
  • This class is used with the Template design pattern as a subclass of the TestTemplate class.

  • The main methods implemented are as follows:

    • testFlightNo()

    • testDestination()

    • testOrigin()

    • testFlightDate()

    • testManifest()

    • testConstructor()

    • testCheckInLuggage()

    • testPrintLuggageManifest()

    • testGetAllowedLuggage()

    • testToString()

These methods are used to test method & attribute naming conventions and types, behaviour and functionality of methods, expected abstractions and inheritance hierarchies of the student's submitted Passenger.java file.

Method-Level

Methods

  • @Before public void init():

  • @Test public void testFlightNo(): This method is used to test the use of proper naming convention and type (String) of the flightNo field in the student Flight class.
    No change is made to the Automated Judge System or the student submission file. There is no returned object nor any accepted parameters, however, the use of inherited attributes from the parent class, TestTemplate is used to track its grading, i.e.

    • boolean passed is used to indicate whether a particular test condition is true and therefore the designated mark should be awarded.
    • Class<?> testClass is used to set the class type to Flight to indicate the Flight class is being tested.

    A Feedback object is created reflecting the appropriate feedback response and mark to be displayed from the test result.


  • @Test public void testDestination(): This method is used to test the use of proper naming convention and type (String) of the destination field in the student Flight class.
    No change is made to the Automated Judge System or the student submission file. There is no returned object nor any accepted parameters, however, the use of inherited attributes from the parent class, TestTemplate is used to track its grading, i.e.

    • boolean passed is used to indicate whether a particular test condition is true and therefore the designated mark should be awarded.
    • Class<?> testClass is used to set the class type to Flight to indicate the Flight class is being tested.

    A Feedback object is created reflecting the appropriate feedback response and mark to be displayed from the test result.


  • @Test public void testOrigin(): This method is used to test the use of proper naming convention and type (String) of the origin field in the student Flightclass.
    No change is made to the Automated Judge System or the student submission file. There is no returned object nor any accepted parameters, however, the use of inherited attributes from the parent class, TestTemplate is used to track its grading, i.e.

    • boolean passed is used to indicate whether a particular test condition is true and therefore the designated mark should be awarded.
    • Class<?> testClass is used to set the class type to FLight to indicate the Flight class is being tested.

    A Feedback object is created reflecting the appropriate feedback response and mark to be displayed from the test result.


  • @Test public void testFlightDate(): This method is used to test the use of proper naming convention and type (LocalDateTime) of the flightDate field in the student Flightclass.
    No change is made to the Automated Judge System or the student submission file. There is no returned object nor any accepted parameters, however, the use of inherited attributes from the parent class, TestTemplate is used to track its grading, i.e.

    • boolean passed is used to indicate whether a particular test condition is true and therefore the designated mark should be awarded.
    • Class<?> testClass is used to set the class type to Flight to indicate the Flight class is being tested.

    A Feedback object is created reflecting the appropriate feedback response and mark to be displayed from the test result.


  • @Test public void testManifest(): This method is used to test the use of proper naming convention and type (LuggageManifest) of the manifest field in the student Flight class.
    No change is made to the Automated Judge System or the student submission file. There is no returned object nor any accepted parameters, however, the use of inherited attributes from the parent class, TestTemplate is used to track its grading, i.e.

    • boolean passed is used to indicate whether a particular test condition is true and therefore the designated mark should be awarded.
    • Class<?> testClass is used to set the class type to Flight to indicate the Flight class is being tested.

    A Feedback object is created reflecting the appropriate feedback response and mark to be displayed from the test result.


  • @Test public void testConstructor():
  • @Test public void testCheckInLuggage():
  • @Test public void testPrintLuggageManifest():
  • @Test public void testGetAllowedLuggage():
  • @Test public void testToString():

Field-Level

Fields

  • private Flight flight1:

Clone this wiki locally