コード例 #1
0
  @Test
  public void testConvertSpeed() {
    double expectedSpeed = 32.72;
    double convertedSpeed;

    simulationDataTest = new SimulationData();
    if (simulationDataTest != null) {
      convertedSpeed = simulationDataTest.convertSpeed(1);
      Assert.assertTrue(convertedSpeed >= expectedSpeed);
    }
  }
コード例 #2
0
  @Test
  public void testCalculateEstimation() {
    double estimation;
    double expectedEstimation = 94608;

    simulationDataTest = new SimulationData();

    if (simulationDataTest != null) {
      estimation = simulationDataTest.calculateTrafficEstimation(1, 1, 1);

      Assert.assertTrue(expectedEstimation == estimation);
    }
  }
コード例 #3
0
  @Test
  public void testConvertSessionDuration() {
    int expectedConvertDuration = 1;
    int convertedDuration;

    simulationDataTest = new SimulationData();
    if (simulationDataTest != null) {
      convertedDuration = simulationDataTest.convertSessionDuration(3);
      Assert.assertEquals(
          "Failure- converted session duration is not correct",
          convertedDuration,
          expectedConvertDuration);
    }
  }
コード例 #4
0
  @Test
  public void testCalculateAvgSpeed() {
    List<Integer> speed = new ArrayList<>();
    speed.add(2);
    speed.add(4);

    double avgSpeed;
    double expectedAvgSpeed = 3;

    simulationDataTest = new SimulationData();

    if (simulationDataTest != null) {
      avgSpeed = simulationDataTest.calculateAverageSpeed(speed);

      Assert.assertTrue(expectedAvgSpeed == avgSpeed);
    }
  }