source: ccr/trunk/nhin-vista/projects/NHINC/Current/Product/Production/Common/NhincLib/test/gov/hhs/fha/nhinc/util/hash/SHA1HashCodeTest.java@ 507

Last change on this file since 507 was 507, checked in by George Lilly, 15 years ago

NHIN gateway and adaptor for use on linux with VistA EHR and RPMS

File size: 1.4 KB
Line 
1/*
2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
4 */
5package gov.hhs.fha.nhinc.util.hash;
6
7import org.junit.After;
8import org.junit.AfterClass;
9import org.junit.Before;
10import org.junit.BeforeClass;
11import org.junit.Test;
12import static org.junit.Assert.*;
13
14/**
15 *
16 * @author westbergl
17 */
18public 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}
Note: See TracBrowser for help on using the repository browser.