1 | /*
|
---|
2 | * To change this template, choose Tools | Templates
|
---|
3 | * and open the template in the editor.
|
---|
4 | */
|
---|
5 | package gov.hhs.fha.nhinc.util.hash;
|
---|
6 |
|
---|
7 | import org.junit.After;
|
---|
8 | import org.junit.AfterClass;
|
---|
9 | import org.junit.Before;
|
---|
10 | import org.junit.BeforeClass;
|
---|
11 | import org.junit.Test;
|
---|
12 | import static org.junit.Assert.*;
|
---|
13 |
|
---|
14 | /**
|
---|
15 | *
|
---|
16 | * @author westbergl
|
---|
17 | */
|
---|
18 | public class SHA1HashCodeTest
|
---|
19 | {
|
---|
20 |
|
---|
21 | public SHA1HashCodeTest()
|
---|
22 | {
|
---|
23 | }
|
---|
24 |
|
---|
25 | @BeforeClass
|
---|
26 | public static void setUpClass() throws Exception
|
---|
27 | {
|
---|
28 | }
|
---|
29 |
|
---|
30 | @AfterClass
|
---|
31 | public static void tearDownClass() throws Exception
|
---|
32 | {
|
---|
33 | }
|
---|
34 |
|
---|
35 | @Before
|
---|
36 | public void setUp()
|
---|
37 | {
|
---|
38 | }
|
---|
39 |
|
---|
40 | @After
|
---|
41 | public void tearDown()
|
---|
42 | {
|
---|
43 | }
|
---|
44 |
|
---|
45 | /**
|
---|
46 | * Test of caluclateSHA1 method, of class SHA1HashCode.
|
---|
47 | */
|
---|
48 | @Test
|
---|
49 | public void testCalculateSHA1() throws Exception
|
---|
50 | {
|
---|
51 | System.out.println("caluclateSHA1");
|
---|
52 | String sText = "<text></text>";
|
---|
53 | String sResult = SHA1HashCode.calculateSHA1(sText);
|
---|
54 | assertEquals("941ce1af75a6a3c1d3b614188b70cd7e20da42fd", sResult);
|
---|
55 |
|
---|
56 | // Test on an empty string.
|
---|
57 | //--------------------------
|
---|
58 | sText = "";
|
---|
59 | sResult = SHA1HashCode.calculateSHA1(sText);
|
---|
60 | assertEquals("da39a3ee5e6b4b0d3255bfef95601890afd80709", sResult);
|
---|
61 |
|
---|
62 | // Test on null.
|
---|
63 | //--------------
|
---|
64 | sText = null;
|
---|
65 | sResult = SHA1HashCode.calculateSHA1(sText);
|
---|
66 | assertEquals("", sResult);
|
---|
67 |
|
---|
68 | }
|
---|
69 | }
|
---|