Migrate tests to JUnit 5 (#8519)

Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
Wouter Born
2020-09-21 18:21:26 +02:00
committed by GitHub
parent 6df6783b60
commit bd82ca82df
478 changed files with 3996 additions and 4419 deletions

View File

@@ -12,8 +12,9 @@
*/
package tests;
import org.junit.Assert;
import org.junit.Test;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;
import org.openhab.binding.paradoxalarm.internal.communication.messages.CommandPayload;
import org.openhab.binding.paradoxalarm.internal.communication.messages.PartitionCommand;
import org.openhab.binding.paradoxalarm.internal.util.ParadoxUtil;
@@ -41,9 +42,9 @@ public class TestCreateCommandPayload {
int payloadIndexOfByteToCheck = 6 + (partitionNumber - 1) / 2;
byte byteValue = bytes[payloadIndexOfByteToCheck];
if ((partitionNumber - 1) % 2 == 0) {
Assert.assertTrue(ParadoxUtil.getHighNibble(byteValue) == command.getCommand());
assertTrue(ParadoxUtil.getHighNibble(byteValue) == command.getCommand());
} else {
Assert.assertTrue(ParadoxUtil.getLowNibble(byteValue) == command.getCommand());
assertTrue(ParadoxUtil.getLowNibble(byteValue) == command.getCommand());
}
}
}

View File

@@ -12,12 +12,11 @@
*/
package tests;
import static org.junit.Assert.*;
import static org.junit.jupiter.api.Assertions.*;
import java.util.Arrays;
import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.openhab.binding.paradoxalarm.internal.communication.crypto.EncryptionHandler;
import org.openhab.binding.paradoxalarm.internal.communication.messages.HeaderCommand;
import org.openhab.binding.paradoxalarm.internal.communication.messages.ParadoxIPPacket;
@@ -70,6 +69,6 @@ public class TestEncryptionHandler {
ParadoxUtil.printByteArray("Expected=", ENCRYPTED_EXPECTED2);
ParadoxUtil.printByteArray("Packet= ", packetBytes);
Assert.assertTrue(Arrays.equals(packetBytes, ENCRYPTED_EXPECTED2));
assertTrue(Arrays.equals(packetBytes, ENCRYPTED_EXPECTED2));
}
}

View File

@@ -12,10 +12,11 @@
*/
package tests;
import static org.junit.jupiter.api.Assertions.*;
import java.util.Arrays;
import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.openhab.binding.paradoxalarm.internal.communication.messages.CommandPayload;
import org.openhab.binding.paradoxalarm.internal.communication.messages.EpromRequestPayload;
import org.openhab.binding.paradoxalarm.internal.communication.messages.HeaderCommand;
@@ -57,7 +58,7 @@ public class TestGetBytes {
ParadoxUtil.printByteArray("Expected =", EXPECTED1);
ParadoxUtil.printByteArray("Packet =", packetBytes);
Assert.assertTrue(Arrays.equals(packetBytes, EXPECTED1));
assertTrue(Arrays.equals(packetBytes, EXPECTED1));
}
private static final byte[] EXPECTED_COMMAND_PAYLOAD = { 0x40, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
@@ -71,7 +72,7 @@ public class TestGetBytes {
ParadoxUtil.printByteArray("Expected =", EXPECTED_COMMAND_PAYLOAD);
ParadoxUtil.printByteArray("Result =", packetBytes);
Assert.assertTrue(Arrays.equals(packetBytes, EXPECTED_COMMAND_PAYLOAD));
assertTrue(Arrays.equals(packetBytes, EXPECTED_COMMAND_PAYLOAD));
}
private static final byte[] EXPECTED_MEMORY_PAYLOAD = { (byte) 0xAA, 0x0A, 0x00, 0x03, 0x08, (byte) 0xF0, 0x00,

View File

@@ -12,8 +12,9 @@
*/
package tests;
import org.junit.Assert;
import org.junit.Test;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;
import org.openhab.binding.paradoxalarm.internal.util.ParadoxUtil;
/**
@@ -31,7 +32,7 @@ public class TestParadoxUtil {
final byte[] EXPECTED_RESULT = { 0x0A, 0x50, 0x08, 0x00, 0x00, 0x01, 0x00, 0x00, 0x59, (byte) 0xEE, (byte) 0xEE,
(byte) 0xEE, (byte) 0xEE, (byte) 0xEE, (byte) 0xEE, (byte) 0xEE };
Assert.assertArrayEquals(EXPECTED_RESULT, extendedArray); //
assertArrayEquals(EXPECTED_RESULT, extendedArray); //
}
@Test
@@ -42,6 +43,6 @@ public class TestParadoxUtil {
byte[] mergedArrays = ParadoxUtil.mergeByteArrays(ARR1, ARR2, ARR3);
final byte[] EXPECTED_RESULT = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 };
Assert.assertArrayEquals(EXPECTED_RESULT, mergedArrays);
assertArrayEquals(EXPECTED_RESULT, mergedArrays);
}
}