Test case created for HexToAscii

This commit is contained in:
Shubham Aggarwal 2016-11-03 09:17:28 +05:30
parent 961f4f5b1e
commit f1d7209198
1 changed files with 10 additions and 2 deletions

View File

@ -3,13 +3,21 @@ package com.baeldung.hexToAscii;
public class HexToAscii {
@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 hexEquivalent = "687474703a2f2f7777772e6261656c64756e672e636f6d2f6a61636b736f6e2d73657269616c697a652d6461746573";
assertEquals(hexEquivalent, asciiToHex(asciiString));
assertEquals(asciiString, hexToAscii(hexEquivalent));
}
private static String asciiToHex(String asciiStr) {