use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.ProfileEntryValue in project open-smart-grid-platform by OSGP.
the class PowerQualityProfileResponseDataMappingTest method testConvertProfileEntryValueDto.
@Test
public void testConvertProfileEntryValueDto() {
final ProfileEntryValue result = this.mapper.map(this.profileEntryDtoDate(), ProfileEntryValue.class);
assertThat(result).withFailMessage("mapping ProfileEntryValueDto should not return null").isNotNull();
assertThat(result).withFailMessage("mapping ProfileEntryValueDto should return correct type").isOfAnyClassIn(ProfileEntryValue.class);
}
use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.ProfileEntryValue in project open-smart-grid-platform by OSGP.
the class PowerQualityProfileResponseDataMapperTest method testConvertGetPowerQualityProfileResponseVo.
@Test
public void testConvertGetPowerQualityProfileResponseVo() {
final PowerQualityProfileDataDto responseDto = this.makeResponseDataDto();
final PowerQualityProfileData responseVo = this.mapper.map(responseDto, PowerQualityProfileData.class);
assertThat(responseVo).withFailMessage("response object should not be null").isNotNull();
assertThat(responseVo.getProfileEntries().get(0).getProfileEntryValues().size()).withFailMessage("response object should return same number of profilentries").isEqualTo(EXPECTED_CLASS.length);
int i = 0;
for (final ProfileEntryValue profileEntryValueVo : responseVo.getProfileEntries().get(0).getProfileEntryValues()) {
final Class<?> clazz = profileEntryValueVo.getValue().getClass();
assertThat(clazz).withFailMessage("the return class should be of the same type").isEqualTo(EXPECTED_CLASS[i++]);
}
}
use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.ProfileEntryValue in project open-smart-grid-platform by OSGP.
the class GetPowerQualityProfileDtoConverter method makeProfileEntries.
private List<ProfileEntry> makeProfileEntries(final PowerQualityProfileDataDto responseDataDto) {
final List<ProfileEntry> profileEntries = new ArrayList<>();
for (final ProfileEntryDto profileEntryDto : responseDataDto.getProfileEntries()) {
final List<ProfileEntryValue> profileEntryValues = new ArrayList<>();
for (final ProfileEntryValueDto profileEntryValueDto : profileEntryDto.getProfileEntryValues()) {
final ProfileEntryValue profileEntryValue = this.mapperFactory.getMapperFacade().map(profileEntryValueDto, ProfileEntryValue.class);
profileEntryValues.add(profileEntryValue);
}
profileEntries.add(new ProfileEntry(profileEntryValues));
}
return profileEntries;
}
Aggregations