diff --git a/pom.xml b/pom.xml index a2f941a7..7517eea1 100644 --- a/pom.xml +++ b/pom.xml @@ -1,69 +1,82 @@ - - - 2.0.5 - - 4.0.0 - net.authorize.sample - SampleCode - jar - 1.0 - SampleCode - http://maven.apache.org - - - net.authorize - anet-java-sdk - 2.0.5 - - - junit - junit - 4.13.1 - - - - - - maven-compiler-plugin - 3.7.0 - - 1.7 - 1.7 - - - - org.apache.maven.plugins - maven-shade-plugin - 2.4.1 - - - package - - shade - - - SampleCode - - - net.authorize.sample.SampleCode - - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.9 - - - **/*.java - - - - - - + + + + 2.0.5 + + 4.0.0 + net.authorize.sample + SampleCode + jar + 1.0 + SampleCode + http://maven.apache.org + + + net.authorize + anet-java-sdk + 2.0.5 + + + junit + junit + 4.13.1 + + + org.junit.jupiter + junit-jupiter-api + 5.7.1 + compile + + + + org.junit.jupiter + junit-jupiter-engine + 5.7.1 + compile + + + + + + + maven-compiler-plugin + 3.7.0 + + 1.7 + 1.7 + + + + org.apache.maven.plugins + maven-shade-plugin + 2.4.1 + + + package + + shade + + + SampleCode + + + net.authorize.sample.SampleCode + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.9 + + + **/*.java + + + + + + \ No newline at end of file diff --git a/src/test/java/net/authorize/sample/Sha512/ComputeTransHashSHA2_hexStringToByteArray_4fd9f61793_Test.java b/src/test/java/net/authorize/sample/Sha512/ComputeTransHashSHA2_hexStringToByteArray_4fd9f61793_Test.java new file mode 100644 index 00000000..2608711c --- /dev/null +++ b/src/test/java/net/authorize/sample/Sha512/ComputeTransHashSHA2_hexStringToByteArray_4fd9f61793_Test.java @@ -0,0 +1,95 @@ +// ********RoostGPT******** +/* +Test generated by RoostGPT for test demoTestGitlab using AI Type Open AI and AI Model gpt-4 + +1. Scenario: Valid Hex String + - Description: The input string is a valid hex string. The function should correctly convert the hex string to a byte array. + - Input: "68656c6c6f" + - Expected Output: byte array equivalent of "hello" + +2. Scenario: Empty String + - Description: The input string is empty. The function should return an empty byte array. + - Input: "" + - Expected Output: Empty byte array + +3. Scenario: Odd Length Hex String + - Description: The input string is a hex string of odd length. The function should throw an exception or return an error. + - Input: "abc" + - Expected Output: Exception or error + +4. Scenario: Non-Hex String + - Description: The input string is not a hex string. The function should throw an exception or return an error. + - Input: "hello" + - Expected Output: Exception or error + +5. Scenario: Null Input + - Description: The input string is null. The function should throw a NullPointerException. + - Input: null + - Expected Output: NullPointerException + +6. Scenario: Large Hex String + - Description: The input string is a large hex string. The function should be able to handle large inputs and return the correct byte array. + - Input: A large hex string + - Expected Output: Correct byte array equivalent + +7. Scenario: Hex String with Uppercase Letters + - Description: The input string is a hex string with uppercase letters. The function should correctly convert the hex string to a byte array. + - Input: "68656C6C6F" + - Expected Output: byte array equivalent of "hello" +*/ + +// ********RoostGPT******** +package net.authorize.sample.Sha512; + +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.*; + +public class ComputeTransHashSHA2_hexStringToByteArray_4fd9f61793_Test { + + @Test + public void testHexStringToByteArray_ValidHexString() { + String input = "68656c6c6f"; + byte[] expected = "hello".getBytes(); + assertArrayEquals(expected, ComputeTransHashSHA2.hexStringToByteArray(input)); + } + + @Test + public void testHexStringToByteArray_EmptyString() { + String input = ""; + byte[] expected = new byte[0]; + assertArrayEquals(expected, ComputeTransHashSHA2.hexStringToByteArray(input)); + } + + @Test + public void testHexStringToByteArray_OddLengthHexString() { + String input = "abc"; + assertThrows(IllegalArgumentException.class, () -> ComputeTransHashSHA2.hexStringToByteArray(input)); + } + + @Test + public void testHexStringToByteArray_NonHexString() { + String input = "hello"; + assertThrows(NumberFormatException.class, () -> ComputeTransHashSHA2.hexStringToByteArray(input)); + } + + @Test + public void testHexStringToByteArray_NullInput() { + String input = null; + assertThrows(NullPointerException.class, () -> ComputeTransHashSHA2.hexStringToByteArray(input)); + } + + @Test + public void testHexStringToByteArray_LargeHexString() { + // TODO: Replace with a large hex string and its byte array equivalent + String input = "LargeHexString"; + byte[] expected = "LargeHexString".getBytes(); + assertArrayEquals(expected, ComputeTransHashSHA2.hexStringToByteArray(input)); + } + + @Test + public void testHexStringToByteArray_HexStringWithUppercaseLetters() { + String input = "68656C6C6F"; + byte[] expected = "hello".getBytes(); + assertArrayEquals(expected, ComputeTransHashSHA2.hexStringToByteArray(input)); + } +}