1 package org.codehaus.plexus.digest;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 import junit.framework.TestCase;
20
21 public class DigestUtilsTest
22 extends TestCase
23 {
24
25 private static final String SERVLETAPI_SHA1 = "bcc82975c0f9c681fcb01cc38504c992553e93ba";
26
27 public void testCleanChecksum()
28 throws DigesterException
29 {
30 String expected = SERVLETAPI_SHA1
31 + " /home/projects/maven/repository-staging/to-ibiblio/maven2/servletapi/servletapi/2.4/servletapi-2.4.pom";
32
33 String s = DigestUtils.cleanChecksum( expected, "SHA1", "servletapi/servletapi/2.4/servletapi-2.4.pom" );
34 assertEquals( "Checksum doesn't match", SERVLETAPI_SHA1, s );
35
36 }
37
38 public void testCleanChecksumAltDash1()
39 throws DigesterException
40 {
41 String expected = SERVLETAPI_SHA1 + " -";
42 String s = DigestUtils.cleanChecksum( expected, "SHA1", "servletapi/servletapi/2.4/servletapi-2.4.pom" );
43 assertEquals( "Checksum doesn't match", SERVLETAPI_SHA1, s );
44 }
45
46 public void testCleanChecksumAltDash2()
47 throws DigesterException
48 {
49 String expected = "SHA1(-)=" + SERVLETAPI_SHA1;
50 String s = DigestUtils.cleanChecksum( expected, "SHA1", "servletapi/servletapi/2.4/servletapi-2.4.pom" );
51 assertEquals( "Checksum doesn't match", SERVLETAPI_SHA1, s );
52 }
53 }