Test case created for HexToAscii
This commit is contained in:
parent
961f4f5b1e
commit
f1d7209198
@ -3,13 +3,21 @@ package com.baeldung.hexToAscii;
|
|||||||
public class HexToAscii {
|
public class HexToAscii {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public static void main() {
|
public static void whenHexToAscii() {
|
||||||
|
|
||||||
|
String asciiString = "http://www.baeldung.com/jackson-serialize-dates";
|
||||||
|
String hexEquivalent = "687474703a2f2f7777772e6261656c64756e672e636f6d2f6a61636b736f6e2d73657269616c697a652d6461746573";
|
||||||
|
|
||||||
|
assertEquals(asciiString, hexToAscii(hexEquivalent));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public static void whenAsciiToHex() {
|
||||||
|
|
||||||
String asciiString = "http://www.baeldung.com/jackson-serialize-dates";
|
String asciiString = "http://www.baeldung.com/jackson-serialize-dates";
|
||||||
String hexEquivalent = "687474703a2f2f7777772e6261656c64756e672e636f6d2f6a61636b736f6e2d73657269616c697a652d6461746573";
|
String hexEquivalent = "687474703a2f2f7777772e6261656c64756e672e636f6d2f6a61636b736f6e2d73657269616c697a652d6461746573";
|
||||||
|
|
||||||
assertEquals(hexEquivalent, asciiToHex(asciiString));
|
assertEquals(hexEquivalent, asciiToHex(asciiString));
|
||||||
assertEquals(asciiString, hexToAscii(hexEquivalent));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String asciiToHex(String asciiStr) {
|
private static String asciiToHex(String asciiStr) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user