IeSinglePointWithQualityConverter extends CustomConverter<IeSinglePointWithQuality, BitmaskMeasurementElementDto> { @Override public BitmaskMeasurementElementDto convert(final IeSinglePointWithQuality source, final Type<? extends BitmaskMeasurementElementDto> destinationType, final MappingContext mappingContext) { int value = 0; value += source.isOn() ? BIT_ON : 0; value += source.isBlocked() ? BIT_BLOCKED : 0; value += source.isSubstituted() ? BIT_SUBSTITUTED : 0; value += source.isNotTopical() ? BIT_NOT_TOPICAL : 0; value += source.isInvalid() ? BIT_INVALID : 0; return new BitmaskMeasurementElementDto((byte) value); }  @Override BitmaskMeasurementElementDto convert(final IeSinglePointWithQuality source,
            final Type<? extends BitmaskMeasurementElementDto> destinationType, final MappingContext mappingContext);  }
@Test public void testConvertIeSinglePointWithQualityOff() { final BitmaskMeasurementElementDto expected = new BitmaskMeasurementElementDto((byte) IE_OFF); final IeSinglePointWithQuality source = new IeSinglePointWithQuality(false, false, false, false, false); final BitmaskMeasurementElementDto actual = this.converter.convert(source, null, null); assertThat(actual).isEqualTo(expected); }
@Test public void testConvertIeSinglePointWithQualityOn() { final BitmaskMeasurementElementDto expected = new BitmaskMeasurementElementDto((byte) IE_ON); final IeSinglePointWithQuality source = new IeSinglePointWithQuality(true, false, false, false, false); final BitmaskMeasurementElementDto actual = this.converter.convert(source, null, null); assertThat(actual).isEqualTo(expected); }
@Test public void testConvertIeSinglePointWithQualityBlocked() { final BitmaskMeasurementElementDto expected = new BitmaskMeasurementElementDto((byte) IE_QUALITY_BLOCKED); final IeSinglePointWithQuality source = new IeSinglePointWithQuality(false, true, false, false, false); final BitmaskMeasurementElementDto actual = this.converter.convert(source, null, null); assertThat(actual).isEqualTo(expected); }
@Test public void testConvertIeSinglePointWithQualitySubstituted() { final BitmaskMeasurementElementDto expected = new BitmaskMeasurementElementDto((byte) IE_QUALITY_SUBSTITUTED); final IeSinglePointWithQuality source = new IeSinglePointWithQuality(false, false, true, false, false); final BitmaskMeasurementElementDto actual = this.converter.convert(source, null, null); assertThat(actual).isEqualTo(expected); }
@Test public void testConvertIeSinglePointWithQualityNotTopical() { final BitmaskMeasurementElementDto expected = new BitmaskMeasurementElementDto((byte) IE_QUALITY_NOT_TOPICAL); final IeSinglePointWithQuality source = new IeSinglePointWithQuality(false, false, false, true, false); final BitmaskMeasurementElementDto actual = this.converter.convert(source, null, null); assertThat(actual).isEqualTo(expected); }
@Test public void testConvertIeSinglePointWithQualityInvalid() { final BitmaskMeasurementElementDto expected = new BitmaskMeasurementElementDto((byte) IE_QUALITY_INVALID); final IeSinglePointWithQuality source = new IeSinglePointWithQuality(false, false, false, false, true); final BitmaskMeasurementElementDto actual = this.converter.convert(source, null, null); assertThat(actual).isEqualTo(expected); }
@Test public void testConvertIeSinglePointWithQualityAll() { final BitmaskMeasurementElementDto expected = new BitmaskMeasurementElementDto((byte) IE_ALL); final IeSinglePointWithQuality source = new IeSinglePointWithQuality(true, true, true, true, true); final BitmaskMeasurementElementDto actual = this.converter.convert(source, null, null); assertThat(actual).isEqualTo(expected); }