forked from yeshodha02/java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestHexAsciiConversion.java
More file actions
58 lines (42 loc) · 1.42 KB
/
TestHexAsciiConversion.java
File metadata and controls
58 lines (42 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package com.edurekademo.utilities;
import static org.junit.Assert.*;
import com.edurekademo.utilities.HexAsciiConvertor;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
public class TestHexAsciiConversion {
HexAsciiConvertor conversion=new HexAsciiConvertor();
String Value="testing ascii convertion into hexadecimal";
String hexvalue="74657374696e6720617363696920636f6e76657274696f6e20696e746f2068657861646563696d616c";
@BeforeClass
public static void setUpBeforeClass() throws Exception {
}
@AfterClass
public static void tearDownAfterClass() throws Exception {
}
@Test
public void testAsciiToHexValid() {
String hexadecimalValue= conversion.convertAsciiToHex(Value);
assertEquals(" ",hexadecimalValue, "74657374696e6720617363696920636f6e76657274696f6e20696e746f2068657861646563696d616c");
System.out.println(hexadecimalValue);
}
@Test
public void testAsciiToHexNull()
{
String hexvalueNull=conversion.convertHexToASCII(null);
assertNull("Result should be null", hexvalueNull);
}
@Test
public void testHexToAsciiValid()
{
String asciiValue=conversion.convertHexToASCII(hexvalue);
assertEquals(" ",asciiValue,"testing ascii convertion into hexadecimal");
System.out.println(asciiValue);
}
@Test
public void testHextoAsciiNull()
{
String asciiValueNull=conversion.convertAsciiToHex(null);
assertNull("Result should be null", asciiValueNull);
}
}