use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SetKeysRequestData in project open-smart-grid-platform by OSGP.
the class SetKeysRequestMappingTest method testWithEmptyArrays.
// To test mapping when arrays are empty
@Test
public void testWithEmptyArrays() {
// build test data
final byte[] authenthicationKey = new byte[1];
final byte[] encryptionKey = new byte[1];
final SetKeysRequestData keySet = new SetKeysRequestData(authenthicationKey, encryptionKey);
// actual mapping
final SetKeysRequestDto keySetDto = this.configurationMapper.map(keySet, SetKeysRequestDto.class);
// check if mapping succeeded
assertThat(keySetDto).isNotNull();
assertThat(keySetDto.getAuthenticationKey()).isNotNull();
assertThat(keySetDto.getEncryptionKey()).isNotNull();
assertThat(keySetDto.getAuthenticationKey().length).isEqualTo(keySet.getAuthenticationKey().length);
assertThat(keySet.getEncryptionKey().length).isEqualTo(keySetDto.getEncryptionKey().length);
}
use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SetKeysRequestData in project open-smart-grid-platform by OSGP.
the class SetKeysRequestMappingTest method testWithNullArrays.
// To test mapping when arrays are null
@Test
public void testWithNullArrays() {
// build test data
final byte[] authenthicationKey = null;
final byte[] encryptionKey = null;
final SetKeysRequestData keySet = new SetKeysRequestData(authenthicationKey, encryptionKey);
// actual mapping
final SetKeysRequestDto keySetDto = this.configurationMapper.map(keySet, SetKeysRequestDto.class);
// check if mapping succeeded
assertThat(keySetDto).isNotNull();
assertThat(keySetDto.getAuthenticationKey()).isNull();
assertThat(keySetDto.getEncryptionKey()).isNull();
}
use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SetKeysRequestData in project open-smart-grid-platform by OSGP.
the class SetKeysRequestMappingTest method testWithArrays.
// To test mapping when arrays hold a value
@Test
public void testWithArrays() {
// build test data
final byte[] authenthicationKey = { 1 };
final byte[] encryptionKey = { 1 };
final SetKeysRequestData keySet = new SetKeysRequestData(authenthicationKey, encryptionKey);
// actual mapping
final SetKeysRequestDto keySetDto = this.configurationMapper.map(keySet, SetKeysRequestDto.class);
// check if mapping succeeded
assertThat(keySetDto).isNotNull();
assertThat(keySetDto.getAuthenticationKey()).isNotNull();
assertThat(keySetDto.getEncryptionKey()).isNotNull();
assertThat(keySetDto.getAuthenticationKey().length).isEqualTo(keySet.getAuthenticationKey().length);
assertThat(keySet.getEncryptionKey().length).isEqualTo(keySetDto.getEncryptionKey().length);
assertThat(keySetDto.getAuthenticationKey()[0]).isEqualTo(keySet.getAuthenticationKey()[0]);
assertThat(keySetDto.getEncryptionKey()[0]).isEqualTo(keySet.getEncryptionKey()[0]);
}
Aggregations