コード例 #1
0
 private void checkHubsAndFacilities_facilityInfo(Workbook workbook) {
   final Sheet facilities = workbook.getSheetAt(1);
   assertThat(facilities.getPhysicalNumberOfRows()).isEqualTo(2);
   final List<String> facilityInfo = getDataFromRow(facilities, 1);
   assertThat(facilityInfo)
       .containsSequence(
           facility1.name.fi,
           String.join(", ", facility1.aliases),
           hub.name.fi,
           operator1.name.fi,
           translationService.translate(facility1.status),
           facility1.statusDescription.fi,
           String.format(Locale.ENGLISH, "%.4f", facility1.location.getCentroid().getX()),
           String.format(Locale.ENGLISH, "%.4f", facility1.location.getCentroid().getY()),
           "",
           "08:00 - 18:00",
           "08:00 - 18:00",
           facility1.openingHours.info.fi,
           ""
               + facility1
                   .builtCapacity
                   .entrySet()
                   .stream()
                   .filter(entry -> asList(motorCapacities).contains(entry.getKey()))
                   .mapToInt(entry -> entry.getValue())
                   .sum(),
           ""
               + facility1
                   .builtCapacity
                   .entrySet()
                   .stream()
                   .filter(entry -> asList(bicycleCapacities).contains(entry.getKey()))
                   .mapToInt(entry -> entry.getValue())
                   .sum(),
           "" + facility1.builtCapacity.getOrDefault(CAR, 0),
           "" + facility1.builtCapacity.getOrDefault(DISABLED, 0),
           "" + facility1.builtCapacity.getOrDefault(ELECTRIC_CAR, 0),
           "" + facility1.builtCapacity.getOrDefault(MOTORCYCLE, 0),
           "" + facility1.builtCapacity.getOrDefault(BICYCLE, 0),
           "" + facility1.builtCapacity.getOrDefault(BICYCLE_SECURE_SPACE, 0));
 }
コード例 #2
0
  private void checkMaxUtilization_rows(Workbook workbook) {
    /*
    EXAMPLE:
    Hubi	Helsinki	X-Park	Liityntä	Henkilöauto	Toiminnassa	50	Arkipäivä	100 %
    Hubi	Helsinki	X-Park	Liityntä	Henkilöauto	Toiminnassa	50	Lauantai	100 %
    Hubi	Helsinki	X-Park	Liityntä	Henkilöauto	Toiminnassa	50	Sunnuntai	100 %
     */

    final Sheet utilization = workbook.getSheetAt(0);
    assertThat(utilization.getPhysicalNumberOfRows()).isEqualTo(4);
    final List<String> businessDay = getDataFromRow(utilization, 1);
    assertThat(businessDay)
        .containsExactly(
            hub.name.fi,
            "Helsinki", // The region name
            operator1.name.fi,
            translationService.translate(facility1.usages.first()),
            translationService.translate(CAR),
            translationService.translate(facility1.status),
            "" + facility1.builtCapacity.get(CAR),
            translationService.translate(DayType.BUSINESS_DAY),
            "100%");

    final List<String> saturday = getDataFromRow(utilization, 2);
    assertThat(saturday)
        .containsExactly(
            hub.name.fi,
            "Helsinki", // The region name
            operator1.name.fi,
            translationService.translate(facility1.usages.first()),
            translationService.translate(CAR),
            translationService.translate(facility1.status),
            "" + facility1.builtCapacity.get(CAR),
            translationService.translate(DayType.SATURDAY),
            "50%");

    final List<String> sunday = getDataFromRow(utilization, 3);
    assertThat(sunday)
        .containsExactly(
            hub.name.fi,
            "Helsinki", // The region name
            operator1.name.fi,
            translationService.translate(facility1.usages.first()),
            translationService.translate(CAR),
            translationService.translate(facility1.status),
            "" + facility1.builtCapacity.get(CAR),
            translationService.translate(DayType.SUNDAY),
            "20%");
  }