Skip to content

Commit f1d7209

Browse files
committed
Test case created for HexToAscii
1 parent 961f4f5 commit f1d7209

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

‎core-java/src/main/java/com/baeldung/hextToAscii/HexToAscii.java‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,23 @@
33
public class HexToAscii {
44

55
@Test
6-
public static void main() {
6+
public static void whenHexToAscii() {
77

88
String asciiString = "http://www.baeldung.com/jackson-serialize-dates";
99
String hexEquivalent = "687474703a2f2f7777772e6261656c64756e672e636f6d2f6a61636b736f6e2d73657269616c697a652d6461746573";
1010

11-
assertEquals(hexEquivalent, asciiToHex(asciiString));
1211
assertEquals(asciiString, hexToAscii(hexEquivalent));
1312
}
1413

14+
@Test
15+
public static void whenAsciiToHex() {
16+
17+
String asciiString = "http://www.baeldung.com/jackson-serialize-dates";
18+
String hexEquivalent = "687474703a2f2f7777772e6261656c64756e672e636f6d2f6a61636b736f6e2d73657269616c697a652d6461746573";
19+
20+
assertEquals(hexEquivalent, asciiToHex(asciiString));
21+
}
22+
1523
private static String asciiToHex(String asciiStr) {
1624

1725
char[] chars = asciiStr.toCharArray();

0 commit comments

Comments
 (0)