// Test if mapping with an empty List succeeds
  @Test
  public void testWithEmptyList() {

    final List<PeriodicMeterReadsGasResponseItemDto> meterReads = new ArrayList<>();
    final PeriodTypeDto periodType = PeriodTypeDto.DAILY;

    final PeriodicMeterReadGasResponseDto periodicMeterReadsContainerGasDto =
        new PeriodicMeterReadGasResponseDto(periodType, meterReads);

    final PeriodicMeterReadsContainerGas periodicMeterReadContainerGas =
        this.monitoringMapper.map(
            periodicMeterReadsContainerGasDto, PeriodicMeterReadsContainerGas.class);

    assertNotNull(periodicMeterReadContainerGas);

    assertTrue(periodicMeterReadContainerGas.getMeterReadsGas().isEmpty());
    assertEquals(
        periodicMeterReadsContainerGasDto.getPeriodType().name(),
        periodicMeterReadContainerGas.getPeriodType().name());
  }
  // Test if mapping with a non-empty List succeeds
  @Test
  public void testWithNonEmptyList() {
    // build test data
    final DlmsMeterValueDto consumption =
        new DlmsMeterValueDto(new BigDecimal(1.0), DlmsUnitDto.M3);

    final Set<AmrProfileStatusCodeFlagDto> amrProfileStatusCodeFlagSet = new TreeSet<>();
    amrProfileStatusCodeFlagSet.add(AmrProfileStatusCodeFlagDto.CRITICAL_ERROR);
    final AmrProfileStatusCodeDto amrProfileStatusCodeDto =
        new AmrProfileStatusCodeDto(amrProfileStatusCodeFlagSet);

    final PeriodicMeterReadsGasResponseItemDto periodicMeterReadsGasDto =
        new PeriodicMeterReadsGasResponseItemDto(
            new Date(), consumption, new Date(), amrProfileStatusCodeDto);
    final List<PeriodicMeterReadsGasResponseItemDto> meterReads = new ArrayList<>();
    meterReads.add(periodicMeterReadsGasDto);

    final PeriodTypeDto periodType = PeriodTypeDto.DAILY;

    final PeriodicMeterReadGasResponseDto periodicMeterReadsContainerDto =
        new PeriodicMeterReadGasResponseDto(periodType, meterReads);
    // actual mapping
    final PeriodicMeterReadsContainerGas periodicMeterReadsContainerGas =
        this.monitoringMapper.map(
            periodicMeterReadsContainerDto, PeriodicMeterReadsContainerGas.class);
    // test mapping
    assertNotNull(periodicMeterReadsContainerGas);

    assertEquals(
        periodicMeterReadsContainerDto.getPeriodType().name(),
        periodicMeterReadsContainerGas.getPeriodType().name());

    assertEquals(
        periodicMeterReadsContainerDto.getMeterReadsGas().size(),
        periodicMeterReadsContainerGas.getMeterReadsGas().size());
    assertEquals(
        periodicMeterReadsContainerDto.getMeterReadsGas().get(0).getLogTime(),
        periodicMeterReadsContainerGas.getMeterReadsGas().get(0).getLogTime());
    assertEquals(
        periodicMeterReadsContainerDto.getMeterReadsGas().get(0).getCaptureTime(),
        periodicMeterReadsContainerGas.getMeterReadsGas().get(0).getCaptureTime());

    assertEquals(
        new BigDecimal("1.0"),
        periodicMeterReadsContainerGas.getMeterReadsGas().get(0).getConsumption().getValue());
    assertEquals(
        OsgpUnit.M3,
        periodicMeterReadsContainerGas.getMeterReadsGas().get(0).getConsumption().getOsgpUnit());

    assertEquals(
        periodicMeterReadsContainerDto
            .getMeterReadsGas()
            .get(0)
            .getAmrProfileStatusCode()
            .getAmrProfileStatusCodeFlags()
            .size(),
        periodicMeterReadsContainerGas
            .getMeterReadsGas()
            .get(0)
            .getAmrProfileStatusCode()
            .getAmrProfileStatusCodeFlags()
            .size());

    assertTrue(
        periodicMeterReadsContainerGas
            .getMeterReadsGas()
            .get(0)
            .getAmrProfileStatusCode()
            .getAmrProfileStatusCodeFlags()
            .contains(AmrProfileStatusCodeFlag.CRITICAL_ERROR));
  }