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;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
class ByteArrayToPrimitiveByteArrayUnitTest {
|
class ByteArrayToPrimitiveByteArrayUnitTest {
|
||||||
public static byte[] expectedArrayValues = {65, 66, 67, 68};
|
private static final byte[] EXPECTED_ARRAY_VALUES = {65, 66, 67, 68};
|
||||||
public static Byte[] byteArray = {65, 66, 67, 68};
|
private static final Byte[] BYTE_ARRAY = {65, 66, 67, 68};
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void givenByteArray_whenConvertingUsingByteValue_thenGiveExpectedResult() {
|
void givenByteArray_whenConvertingUsingByteValue_thenGiveExpectedResult() {
|
||||||
byte[] newByteArray = new byte[byteArray.length];
|
byte[] newByteArray = new byte[BYTE_ARRAY.length];
|
||||||
for (int i = 0; i < byteArray.length; i++) {
|
for (int i = 0; i < BYTE_ARRAY.length; i++) {
|
||||||
newByteArray[i] = byteArray[i].byteValue();
|
newByteArray[i] = BYTE_ARRAY[i].byteValue();
|
||||||
}
|
}
|
||||||
Assertions.assertThat(newByteArray)
|
Assertions.assertThat(newByteArray)
|
||||||
.containsExactly(expectedArrayValues);
|
.containsExactly(EXPECTED_ARRAY_VALUES);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void givenByteArray_whenConvertingUsingUnboxing_thenGiveExpectedResult() {
|
void givenByteArray_whenConvertingUsingUnboxing_thenGiveExpectedResult() {
|
||||||
byte[] newByteArray = new byte[byteArray.length];
|
byte[] newByteArray = new byte[BYTE_ARRAY.length];
|
||||||
for (int i = 0; i < byteArray.length; i++) {
|
for (int i = 0; i < BYTE_ARRAY.length; i++) {
|
||||||
newByteArray[i] = byteArray[i];
|
newByteArray[i] = BYTE_ARRAY[i];
|
||||||
}
|
}
|
||||||
Assertions.assertThat(newByteArray)
|
Assertions.assertThat(newByteArray)
|
||||||
.containsExactly(expectedArrayValues);
|
.containsExactly(EXPECTED_ARRAY_VALUES);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void givenByteArray_whenConvertingArrayUtils_thenGiveExpectedResult() {
|
void givenByteArray_whenConvertingArrayUtils_thenGiveExpectedResult() {
|
||||||
byte[] newByteArray = ArrayUtils.toPrimitive(byteArray);
|
byte[] newByteArray = ArrayUtils.toPrimitive(BYTE_ARRAY);
|
||||||
|
|
||||||
Assertions.assertThat(newByteArray)
|
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;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
class PrimitiveByteArrayToByteArrayUnitTest {
|
class PrimitiveByteArrayToByteArrayUnitTest {
|
||||||
public static byte[] primitiveByteArray = {65, 66, 67, 68};
|
private static final byte[] PRIMITIVE_BYTE_ARRAY = {65, 66, 67, 68};
|
||||||
public static Byte[] expectedArrayValues = {65, 66, 67, 68};
|
private static final Byte[] EXPECTED_ARRAY_VALUES = {65, 66, 67, 68};
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void givenPrimitiveByteArray_whenConvertingUsingByteValueOf_thenGiveExpectedResult() {
|
void givenPrimitiveByteArray_whenConvertingUsingByteValueOf_thenGiveExpectedResult() {
|
||||||
Byte[] newByteArray = new Byte[primitiveByteArray.length];
|
Byte[] newByteArray = new Byte[PRIMITIVE_BYTE_ARRAY.length];
|
||||||
for (int i = 0; i < primitiveByteArray.length; i++) {
|
for (int i = 0; i < PRIMITIVE_BYTE_ARRAY.length; i++) {
|
||||||
newByteArray[i] = Byte.valueOf(primitiveByteArray[i]);
|
newByteArray[i] = Byte.valueOf(PRIMITIVE_BYTE_ARRAY[i]);
|
||||||
}
|
}
|
||||||
Assertions.assertThat(newByteArray)
|
Assertions.assertThat(newByteArray)
|
||||||
.containsExactly(expectedArrayValues);
|
.containsExactly(EXPECTED_ARRAY_VALUES);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void givenPrimitiveByteArray_whenConvertingUsingAutoboxing_thenGiveExpectedResult() {
|
void givenPrimitiveByteArray_whenConvertingUsingAutoboxing_thenGiveExpectedResult() {
|
||||||
Byte[] newByteArray = new Byte[primitiveByteArray.length];
|
Byte[] newByteArray = new Byte[PRIMITIVE_BYTE_ARRAY.length];
|
||||||
for (int i = 0; i < primitiveByteArray.length; i++) {
|
for (int i = 0; i < PRIMITIVE_BYTE_ARRAY.length; i++) {
|
||||||
newByteArray[i] = primitiveByteArray[i];
|
newByteArray[i] = PRIMITIVE_BYTE_ARRAY[i];
|
||||||
}
|
}
|
||||||
Assertions.assertThat(newByteArray)
|
Assertions.assertThat(newByteArray)
|
||||||
.containsExactly(expectedArrayValues);
|
.containsExactly(EXPECTED_ARRAY_VALUES);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void givenPrimitiveByteArray_whenConvertingUsingAutoboxingAndArraysSetAll_thenGiveExpectedResult() {
|
void givenPrimitiveByteArray_whenConvertingUsingAutoboxingAndArraysSetAll_thenGiveExpectedResult() {
|
||||||
Byte[] newByteArray = new Byte[primitiveByteArray.length];
|
Byte[] newByteArray = new Byte[PRIMITIVE_BYTE_ARRAY.length];
|
||||||
Arrays.setAll(newByteArray, n -> primitiveByteArray[n]);
|
Arrays.setAll(newByteArray, n -> PRIMITIVE_BYTE_ARRAY[n]);
|
||||||
|
|
||||||
Assertions.assertThat(newByteArray)
|
Assertions.assertThat(newByteArray)
|
||||||
.containsExactly(expectedArrayValues);
|
.containsExactly(EXPECTED_ARRAY_VALUES);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void givenPrimitiveByteArray_whenConvertingUsingArrayUtils_thenGiveExpectedResult() {
|
void givenPrimitiveByteArray_whenConvertingUsingArrayUtils_thenGiveExpectedResult() {
|
||||||
Byte[] newByteArray = ArrayUtils.toObject(primitiveByteArray);
|
Byte[] newByteArray = ArrayUtils.toObject(PRIMITIVE_BYTE_ARRAY);
|
||||||
|
|
||||||
Assertions.assertThat(newByteArray)
|
Assertions.assertThat(newByteArray)
|
||||||
.containsExactly(expectedArrayValues);
|
.containsExactly(EXPECTED_ARRAY_VALUES);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user