commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1744418 - /commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/digest/DigestUtilsTest.java
Date Wed, 18 May 2016 15:01:37 GMT
Author: sebb
Date: Wed May 18 15:01:37 2016
New Revision: 1744418

URL: http://svn.apache.org/viewvc?rev=1744418&view=rev
Log:
Drop tests for dropped methods

Modified:
    commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/digest/DigestUtilsTest.java

Modified: commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/digest/DigestUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/digest/DigestUtilsTest.java?rev=1744418&r1=1744417&r2=1744418&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/digest/DigestUtilsTest.java
(original)
+++ commons/proper/codec/trunk/src/test/java/org/apache/commons/codec/digest/DigestUtilsTest.java
Wed May 18 15:01:37 2016
@@ -17,7 +17,6 @@
 
 package org.apache.commons.codec.digest;
 
-import static org.apache.commons.codec.binary.StringUtils.getByteBufferUtf8;
 import static org.apache.commons.codec.binary.StringUtils.getBytesUtf8;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -111,9 +110,6 @@ public class DigestUtilsTest {
 
         assertEquals(DigestUtils.md2Hex(testData),
                 DigestUtils.md2Hex(new ByteArrayInputStream(testData)));
-
-        assertEquals(DigestUtils.md2Hex(testData),
-                DigestUtils.md2Hex(ByteBuffer.wrap(testData)));
 }
 
     /**
@@ -167,29 +163,12 @@ public class DigestUtilsTest {
 
         assertEquals(DigestUtils.md5Hex(testData),
                 DigestUtils.md5Hex(new ByteArrayInputStream(testData)));
-
-        assertEquals(DigestUtils.md5Hex(testData),
-                DigestUtils.md5Hex(ByteBuffer.wrap(testData)));
 }
 
     /**
      * An MD5 hash converted to hex should always be 32 characters.
      */
     @Test
-    public void testMd5HexLengthForByteBuffer() {
-        String hashMe = "this is some string that is longer than 32 characters";
-        String hash = DigestUtils.md5Hex(getByteBufferUtf8(hashMe));
-        assertEquals(32, hash.length());
-
-        hashMe = "length < 32";
-        hash = DigestUtils.md5Hex(getByteBufferUtf8(hashMe));
-        assertEquals(32, hash.length());
-    }
-
-    /**
-     * An MD5 hash converted to hex should always be 32 characters.
-     */
-    @Test
     public void testMd5HexLengthForBytes() {
         String hashMe = "this is some string that is longer than 32 characters";
         String hash = DigestUtils.md5Hex(getBytesUtf8(hashMe));
@@ -204,20 +183,6 @@ public class DigestUtilsTest {
      * An MD5 hash should always be a 16 element byte[].
      */
     @Test
-    public void testMd5LengthForByteBuffer() {
-        String hashMe = "this is some string that is longer than 16 characters";
-        byte[] hash = DigestUtils.md5(getByteBufferUtf8(hashMe));
-        assertEquals(16, hash.length);
-
-        hashMe = "length < 16";
-        hash = DigestUtils.md5(getByteBufferUtf8(hashMe));
-        assertEquals(16, hash.length);
-    }
-
-    /**
-     * An MD5 hash should always be a 16 element byte[].
-     */
-    @Test
     public void testMd5LengthForBytes() {
         String hashMe = "this is some string that is longer than 16 characters";
         byte[] hash = DigestUtils.md5(getBytesUtf8(hashMe));
@@ -240,8 +205,6 @@ public class DigestUtilsTest {
             DigestUtils.sha1Hex("abcdbcdecdefdefgefghfghighij" + "hijkijkljklmklmnlmnomnopnopq"));
         assertEquals(DigestUtils.sha1Hex(testData),
                 DigestUtils.sha1Hex(new ByteArrayInputStream(testData)));
-        assertEquals(DigestUtils.sha1Hex(testData),
-                DigestUtils.sha1Hex(ByteBuffer.wrap(testData)));
     }
 
     @Test
@@ -301,9 +264,10 @@ public class DigestUtilsTest {
     @Test
     public void testSha224() throws IOException {
         assumeJava8();
-        assertEquals("d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f", DigestUtils.sha224Hex(""));
+        assertEquals("d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f",
+                DigestUtils.digest(MessageDigestAlgorithms.SHA_224,StringUtils.getBytesUtf8("")));
         assertEquals("730e109bd7a8a32b1cb9d9a09aa2325d2430587ddbc0c38bad911525",
-                DigestUtils.sha224Hex("The quick brown fox jumps over the lazy dog"));
+                DigestUtils.digest(MessageDigestAlgorithms.SHA_224,StringUtils.getBytesUtf8("The
quick brown fox jumps over the lazy dog")));
 
         // Examples from FIPS 180-4?
     }
@@ -320,8 +284,6 @@ public class DigestUtilsTest {
 
     assertEquals(DigestUtils.sha256Hex(testData),
             DigestUtils.sha256Hex(new ByteArrayInputStream(testData)));
-    assertEquals(DigestUtils.sha256Hex(testData),
-            DigestUtils.sha256Hex(ByteBuffer.wrap(testData)));
     }
 
     @Test
@@ -339,8 +301,6 @@ public class DigestUtilsTest {
                        "hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"));
     assertEquals(DigestUtils.sha384Hex(testData),
             DigestUtils.sha384Hex(new ByteArrayInputStream(testData)));
-    assertEquals(DigestUtils.sha384Hex(testData),
-            DigestUtils.sha384Hex(ByteBuffer.wrap(testData)));
     }
 
     @Test
@@ -359,11 +319,6 @@ public class DigestUtilsTest {
     }
 
     @Test
-    public void testSha512HexByteBuffer() throws IOException {
-        assertEquals(DigestUtils.sha512Hex(testData), DigestUtils.sha512Hex(ByteBuffer.wrap(testData)));
-    }
-
-    @Test
     public void testSha512HexInputStream() throws IOException {
         assertEquals(DigestUtils.sha512Hex(testData),
                 DigestUtils.sha512Hex(new ByteArrayInputStream(testData)));



Mime
View raw message