Advertisement
IvetValcheva

Untitled

Nov 17th, 2022
541
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.54 KB | None | 0 0
  1. import tripadministratorjava.Company;
  2. import tripadministratorjava.Transportation;
  3. import tripadministratorjava.Trip;
  4. import tripadministratorjava.TripAdministratorImpl;
  5.  
  6. import org.junit.Before;
  7. import org.junit.Test;
  8.  
  9. import java.util.Arrays;
  10.  
  11. import static org.junit.Assert.*;
  12.  
  13. public class Test033 {
  14.  
  15.     private TripAdministratorImpl tripAdministrations;
  16.  
  17.     private Company c1 = new Company("a", 2);
  18.     private Company c2 = new Company("b", 1);
  19.     private Company c3 = new Company("c", 1);
  20.     private Company c4 = new Company("d", 2);
  21.  
  22.     private Trip t1 = new Trip("a", 1, Transportation.NONE, 1);
  23.     private Trip t2 = new Trip("b", 1, Transportation.BUS, 1);
  24.     private Trip t3 = new Trip("c", 1, Transportation.BUS, 1);
  25.     private Trip t4 = new Trip("d", 1, Transportation.BUS, 1);
  26.  
  27.     @Before
  28.     public void Setup() {
  29.         this.tripAdministrations = new TripAdministratorImpl();
  30.     }
  31.  
  32.     @Test
  33.     public void TestGetAllTripsInPriceRange() {
  34.         this.tripAdministrations.addCompany(c1);
  35.         this.tripAdministrations.addCompany(c2);
  36.         this.tripAdministrations.addCompany(c3);
  37.         this.tripAdministrations.addCompany(c4);
  38.         this.tripAdministrations.addTrip(c1, t1);
  39.         this.tripAdministrations.addTrip(c1, t2);
  40.         this.tripAdministrations.addTrip(c4, t3);
  41.         this.tripAdministrations.addTrip(c4, t4);
  42.  
  43.         var res = this.tripAdministrations.getAllTripsInPriceRange(1, 1);
  44.         var expected = Arrays.asList(t1, t2, t3, t4);
  45.         assertEquals(res, expected);
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement