BAEL-7453 - Fix modifiers and naming for test classes fields
This commit is contained in:
parent
a73a408c6c
commit
bd1239c699
|
@ -5,34 +5,34 @@ import org.assertj.core.api.Assertions;
|
|||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class ByteArrayToPrimitiveByteArrayUnitTest {
|
||||
public static byte[] expectedArrayValues = {65, 66, 67, 68};
|
||||
public static Byte[] byteArray = {65, 66, 67, 68};
|
||||
private static final byte[] EXPECTED_ARRAY_VALUES = {65, 66, 67, 68};
|
||||
private static final Byte[] BYTE_ARRAY = {65, 66, 67, 68};
|
||||
|
||||
@Test
|
||||
void givenByteArray_whenConvertingUsingByteValue_thenGiveExpectedResult() {
|
||||
byte[] newByteArray = new byte[byteArray.length];
|
||||
for (int i = 0; i < byteArray.length; i++) {
|
||||
newByteArray[i] = byteArray[i].byteValue();
|
||||
byte[] newByteArray = new byte[BYTE_ARRAY.length];
|
||||
for (int i = 0; i < BYTE_ARRAY.length; i++) {
|
||||
newByteArray[i] = BYTE_ARRAY[i].byteValue();
|
||||
}
|
||||
Assertions.assertThat(newByteArray)
|
||||
.containsExactly(expectedArrayValues);
|
||||
.containsExactly(EXPECTED_ARRAY_VALUES);
|
||||
}
|
||||
|
||||
@Test
|
||||
void givenByteArray_whenConvertingUsingUnboxing_thenGiveExpectedResult() {
|
||||
byte[] newByteArray = new byte[byteArray.length];
|
||||
for (int i = 0; i < byteArray.length; i++) {
|
||||
newByteArray[i] = byteArray[i];
|
||||
byte[] newByteArray = new byte[BYTE_ARRAY.length];
|
||||
for (int i = 0; i < BYTE_ARRAY.length; i++) {
|
||||
newByteArray[i] = BYTE_ARRAY[i];
|
||||
}
|
||||
Assertions.assertThat(newByteArray)
|
||||
.containsExactly(expectedArrayValues);
|
||||
.containsExactly(EXPECTED_ARRAY_VALUES);
|
||||
}
|
||||
|
||||
@Test
|
||||
void givenByteArray_whenConvertingArrayUtils_thenGiveExpectedResult() {
|
||||
byte[] newByteArray = ArrayUtils.toPrimitive(byteArray);
|
||||
byte[] newByteArray = ArrayUtils.toPrimitive(BYTE_ARRAY);
|
||||
|
||||
Assertions.assertThat(newByteArray)
|
||||
.containsExactly(expectedArrayValues);
|
||||
.containsExactly(EXPECTED_ARRAY_VALUES);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,43 +7,43 @@ import org.assertj.core.api.Assertions;
|
|||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class PrimitiveByteArrayToByteArrayUnitTest {
|
||||
public static byte[] primitiveByteArray = {65, 66, 67, 68};
|
||||
public static Byte[] expectedArrayValues = {65, 66, 67, 68};
|
||||
private static final byte[] PRIMITIVE_BYTE_ARRAY = {65, 66, 67, 68};
|
||||
private static final Byte[] EXPECTED_ARRAY_VALUES = {65, 66, 67, 68};
|
||||
|
||||
@Test
|
||||
void givenPrimitiveByteArray_whenConvertingUsingByteValueOf_thenGiveExpectedResult() {
|
||||
Byte[] newByteArray = new Byte[primitiveByteArray.length];
|
||||
for (int i = 0; i < primitiveByteArray.length; i++) {
|
||||
newByteArray[i] = Byte.valueOf(primitiveByteArray[i]);
|
||||
Byte[] newByteArray = new Byte[PRIMITIVE_BYTE_ARRAY.length];
|
||||
for (int i = 0; i < PRIMITIVE_BYTE_ARRAY.length; i++) {
|
||||
newByteArray[i] = Byte.valueOf(PRIMITIVE_BYTE_ARRAY[i]);
|
||||
}
|
||||
Assertions.assertThat(newByteArray)
|
||||
.containsExactly(expectedArrayValues);
|
||||
.containsExactly(EXPECTED_ARRAY_VALUES);
|
||||
}
|
||||
|
||||
@Test
|
||||
void givenPrimitiveByteArray_whenConvertingUsingAutoboxing_thenGiveExpectedResult() {
|
||||
Byte[] newByteArray = new Byte[primitiveByteArray.length];
|
||||
for (int i = 0; i < primitiveByteArray.length; i++) {
|
||||
newByteArray[i] = primitiveByteArray[i];
|
||||
Byte[] newByteArray = new Byte[PRIMITIVE_BYTE_ARRAY.length];
|
||||
for (int i = 0; i < PRIMITIVE_BYTE_ARRAY.length; i++) {
|
||||
newByteArray[i] = PRIMITIVE_BYTE_ARRAY[i];
|
||||
}
|
||||
Assertions.assertThat(newByteArray)
|
||||
.containsExactly(expectedArrayValues);
|
||||
.containsExactly(EXPECTED_ARRAY_VALUES);
|
||||
}
|
||||
|
||||
@Test
|
||||
void givenPrimitiveByteArray_whenConvertingUsingAutoboxingAndArraysSetAll_thenGiveExpectedResult() {
|
||||
Byte[] newByteArray = new Byte[primitiveByteArray.length];
|
||||
Arrays.setAll(newByteArray, n -> primitiveByteArray[n]);
|
||||
Byte[] newByteArray = new Byte[PRIMITIVE_BYTE_ARRAY.length];
|
||||
Arrays.setAll(newByteArray, n -> PRIMITIVE_BYTE_ARRAY[n]);
|
||||
|
||||
Assertions.assertThat(newByteArray)
|
||||
.containsExactly(expectedArrayValues);
|
||||
.containsExactly(EXPECTED_ARRAY_VALUES);
|
||||
}
|
||||
|
||||
@Test
|
||||
void givenPrimitiveByteArray_whenConvertingUsingArrayUtils_thenGiveExpectedResult() {
|
||||
Byte[] newByteArray = ArrayUtils.toObject(primitiveByteArray);
|
||||
Byte[] newByteArray = ArrayUtils.toObject(PRIMITIVE_BYTE_ARRAY);
|
||||
|
||||
Assertions.assertThat(newByteArray)
|
||||
.containsExactly(expectedArrayValues);
|
||||
.containsExactly(EXPECTED_ARRAY_VALUES);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue