Commit b54cfadd authored by Amirhosein Rajabpour's avatar Amirhosein Rajabpour

final commit (tests added)

parent 70bf88cf
package test;
import com.TicketManagement.Airplane;
import com.TicketManagement.Seat;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class AirplaneTest {
static Airplane airplane;
static Seat seat;
@BeforeAll
public static void creatairplane(){
seat=new Seat(1,"firstClass");
airplane=new Airplane(seat,"iranAir","707");
}
@Test
public void testModel(){
assertEquals("707",airplane.getModel());
}
@Test
public void testAirPlaneAgency(){
assertEquals("iranAir",airplane.getAirplaneagency());
}
}
package test;
import com.TicketManagement.Airplane;
import com.TicketManagement.Flight;
import com.TicketManagement.Seat;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import java.util.Date;
import static org.junit.jupiter.api.Assertions.*;
class FlightTest {
static Flight flight;
static Date date;
static Airplane airplane;
static Seat seat;
@BeforeAll
public static void creatflight()
{
seat = new Seat(1,"firstClass");
airplane = new Airplane(seat,"iranAir","707");
flight = new Flight(date,1,"mashhad","tehran",airplane);
}
@Test
public void testdestenation()
{
assertEquals("mashhad",flight.getDestination());
}
@Test
public void teststart()
{
assertEquals("tehran",flight.getSource());
}
@Test
public void testAirplane()
{
assertEquals(airplane.getModel(),flight.getModel());
}
@Test
public void testDate()
{
assertEquals(date,flight.getDate());
}
}
\ No newline at end of file
package test;
import com.TicketManagement.Airplane;
import com.TicketManagement.Flight;
import com.TicketManagement.Seat;
import com.TicketManagement.Ticket;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import java.util.Date;
import static org.junit.jupiter.api.Assertions.*;
class TicketTest {
static Seat seat;
static Flight flight;
static Ticket ticket;
static Date date;
static Airplane airplane;
@BeforeAll
public static void createticket() {
seat = new Seat(1, "firstClass");
airplane = new Airplane(seat, "iranAir", "707");
flight = new Flight(date, 1, "tehran", "mashad", airplane);
ticket = new Ticket(seat, flight, 10, "kabab");
}
@Test
public void testTcketgetseatnumber() {
assertEquals(1, ticket.getSeatnumber());
}
@Test
public void testTicketgetflightnumber() {
assertEquals(1, ticket.getFlightnumber());
}
@Test
public void testticketgetcargo() {
assertEquals(10, ticket.getLuggageWeight());
}
@Test
public void testTicketgetmeal() {
assertEquals("kabab", ticket.getFood());
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment