Merge pull request #15788 from sIvanovKonstantyn/master

BAEL-6716 - Storing UUID as Base64 String in Java (Fixes for tests methods)
This commit is contained in:
Vini 2024-02-01 15:33:49 +01:00 committed by GitHub
commit ebcae79312
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 6 deletions

View File

@ -14,7 +14,7 @@ public class DecodeUUIDStringFromBase64UnitTest {
private final UUID originalUUID = UUID.fromString("cc5f93f7-8cf1-4a51-83c6-e740313a0c6c");
@Test
public void shouldDecodeUUIDUsingByteArrayAndBase64Decoder() {
public void givenEncodedString_whenDecodingUsingBase64Decoder_thenGiveExpectedUUID() {
String expectedEncodedString = "UUrxjPeTX8xsDDoxQOfGgw";
byte[] decodedBytes = Base64.getDecoder()
.decode(expectedEncodedString);
@ -23,7 +23,7 @@ public class DecodeUUIDStringFromBase64UnitTest {
}
@Test
public void shouldDecodeUUIDUsingByteBufferAndBase64UrlDecoder() {
public void givenEncodedString_whenDecodingUsingByteBufferAndBase64UrlDecoder_thenGiveExpectedUUID() {
String expectedEncodedString = "zF-T94zxSlGDxudAMToMbA";
byte[] decodedBytes = Base64.getUrlDecoder()
.decode(expectedEncodedString);
@ -35,7 +35,7 @@ public class DecodeUUIDStringFromBase64UnitTest {
}
@Test
public void shouldDecodeUUIDUsingApacheUtils() {
public void givenEncodedString_whenDecodingUsingApacheUtils_thenGiveExpectedUUID() {
String expectedEncodedString = "UUrxjPeTX8xsDDoxQOfGgw";
byte[] decodedBytes = decodeBase64(expectedEncodedString);
UUID uuid = Conversion.byteArrayToUuid(decodedBytes, 0);

View File

@ -14,7 +14,7 @@ public class EncodeUUIDToBase64StringUnitTest {
private final UUID originalUUID = UUID.fromString("cc5f93f7-8cf1-4a51-83c6-e740313a0c6c");
@Test
public void shouldEncodeUUIDUsingByteArrayAndBase64Encoder() {
public void givenUUID_whenEncodingUsingBase64Encoder_thenGiveExpectedEncodedString() {
String expectedEncodedString = "UUrxjPeTX8xsDDoxQOfGgw";
byte[] uuidBytes = convertToByteArray(originalUUID);
String encodedUUID = Base64.getEncoder().withoutPadding()
@ -23,7 +23,7 @@ public class EncodeUUIDToBase64StringUnitTest {
}
@Test
public void shouldEncodeUUIDUsingByteBufferAndBase64UrlEncoder() {
public void givenUUID_whenEncodingUsingByteBufferAndBase64UrlEncoder_thenGiveExpectedEncodedString() {
String expectedEncodedString = "zF-T94zxSlGDxudAMToMbA";
ByteBuffer byteBuffer = ByteBuffer.wrap(new byte[16]);
byteBuffer.putLong(originalUUID.getMostSignificantBits());
@ -34,7 +34,7 @@ public class EncodeUUIDToBase64StringUnitTest {
}
@Test
public void shouldEncodeUUIDUsingApacheUtils() {
public void givenUUID_whenEncodingUsingApacheUtils_thenGiveExpectedEncodedString() {
String expectedEncodedString = "UUrxjPeTX8xsDDoxQOfGgw";
byte[] bytes = Conversion.uuidToByteArray(originalUUID, new byte[16], 0, 16);
String encodedUUID = encodeBase64URLSafeString(bytes);