forked from TrueCloudLab/frostfs-sdk-java
35 lines
1 KiB
Java
35 lines
1 KiB
Java
package info.frostfs.sdk.mappers;
|
|
|
|
import info.frostfs.sdk.dto.OwnerId;
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat;
|
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
|
|
|
public class OwnerIdMapperTest {
|
|
private static final String OWNER_ID = "NVxUSpEEJzYXZZtUs18PrJTD9QZkLLNQ8S";
|
|
|
|
@Test
|
|
void toGrpcMessage_success() {
|
|
//Given
|
|
var ownerId = new OwnerId(OWNER_ID);
|
|
var expected = new byte[]{
|
|
53, 110, 42, -125, -76, -25, -44, -94, 22, -98, 117, -100, -5, 103, 74, -128, -51, 37, -116, -102, 71,
|
|
-1, 95, -4, 3
|
|
};
|
|
|
|
//When
|
|
var result = OwnerIdMapper.toGrpcMessage(ownerId);
|
|
|
|
//Then
|
|
assertNotNull(result);
|
|
assertThat(result.getValue().toByteArray()).hasSize(25).containsExactly(expected);
|
|
}
|
|
|
|
@Test
|
|
void toGrpcMessage_null() {
|
|
//When + Then
|
|
assertNull(OwnerIdMapper.toGrpcMessage(null));
|
|
}
|
|
}
|