View Javadoc
1   package org.apache.maven.plugin.install;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import junit.framework.Assert;
23  import junit.framework.TestCase;
24  
25  import java.io.ByteArrayInputStream;
26  
27  public class DualDigesterTest
28      extends TestCase
29  {
30      public void testGetMd5()
31          throws Exception
32      {
33          DualDigester dualDigester = new DualDigester();
34          dualDigester.calculate( new ByteArrayInputStream( "A Dog And A Cat".getBytes() ) );
35          Assert.assertEquals( "39bc6b34be719cab3a3dc922445aae7c", dualDigester.getMd5() );
36          Assert.assertEquals( "d07b1e7ecc7986b3f1126ddf1b67e3601ec362a9", dualDigester.getSha1() );
37          dualDigester.calculate( new ByteArrayInputStream( "Yep, we do it again".getBytes() ) );
38          Assert.assertEquals( "8cd83a9cbbd7076f668c2bcc0379ed49", dualDigester.getMd5() );
39          Assert.assertEquals( "194ebcb8d168cffdc25c3b854d6187b568cf6273", dualDigester.getSha1() );
40      }
41  
42  }