Skip to content

Commit 89b1661

Browse files
committed
Drop tests for dropped methods
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/codec/trunk@1744418 13f79535-47bb-0310-9956-ffa450edef68
1 parent d47ef8f commit 89b1661

1 file changed

Lines changed: 3 additions & 48 deletions

File tree

src/test/java/org/apache/commons/codec/digest/DigestUtilsTest.java

Lines changed: 3 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
package org.apache.commons.codec.digest;
1919

20-
import static org.apache.commons.codec.binary.StringUtils.getByteBufferUtf8;
2120
import static org.apache.commons.codec.binary.StringUtils.getBytesUtf8;
2221
import static org.junit.Assert.assertEquals;
2322
import static org.junit.Assert.assertNotNull;
@@ -111,9 +110,6 @@ public void testMd2Hex() throws IOException {
111110

112111
assertEquals(DigestUtils.md2Hex(testData),
113112
DigestUtils.md2Hex(new ByteArrayInputStream(testData)));
114-
115-
assertEquals(DigestUtils.md2Hex(testData),
116-
DigestUtils.md2Hex(ByteBuffer.wrap(testData)));
117113
}
118114

119115
/**
@@ -167,25 +163,8 @@ public void testMd5Hex() throws IOException {
167163

168164
assertEquals(DigestUtils.md5Hex(testData),
169165
DigestUtils.md5Hex(new ByteArrayInputStream(testData)));
170-
171-
assertEquals(DigestUtils.md5Hex(testData),
172-
DigestUtils.md5Hex(ByteBuffer.wrap(testData)));
173166
}
174167

175-
/**
176-
* An MD5 hash converted to hex should always be 32 characters.
177-
*/
178-
@Test
179-
public void testMd5HexLengthForByteBuffer() {
180-
String hashMe = "this is some string that is longer than 32 characters";
181-
String hash = DigestUtils.md5Hex(getByteBufferUtf8(hashMe));
182-
assertEquals(32, hash.length());
183-
184-
hashMe = "length < 32";
185-
hash = DigestUtils.md5Hex(getByteBufferUtf8(hashMe));
186-
assertEquals(32, hash.length());
187-
}
188-
189168
/**
190169
* An MD5 hash converted to hex should always be 32 characters.
191170
*/
@@ -200,20 +179,6 @@ public void testMd5HexLengthForBytes() {
200179
assertEquals(32, hash.length());
201180
}
202181

203-
/**
204-
* An MD5 hash should always be a 16 element byte[].
205-
*/
206-
@Test
207-
public void testMd5LengthForByteBuffer() {
208-
String hashMe = "this is some string that is longer than 16 characters";
209-
byte[] hash = DigestUtils.md5(getByteBufferUtf8(hashMe));
210-
assertEquals(16, hash.length);
211-
212-
hashMe = "length < 16";
213-
hash = DigestUtils.md5(getByteBufferUtf8(hashMe));
214-
assertEquals(16, hash.length);
215-
}
216-
217182
/**
218183
* An MD5 hash should always be a 16 element byte[].
219184
*/
@@ -240,8 +205,6 @@ public void testSha1Hex() throws IOException {
240205
DigestUtils.sha1Hex("abcdbcdecdefdefgefghfghighij" + "hijkijkljklmklmnlmnomnopnopq"));
241206
assertEquals(DigestUtils.sha1Hex(testData),
242207
DigestUtils.sha1Hex(new ByteArrayInputStream(testData)));
243-
assertEquals(DigestUtils.sha1Hex(testData),
244-
DigestUtils.sha1Hex(ByteBuffer.wrap(testData)));
245208
}
246209

247210
@Test
@@ -301,9 +264,10 @@ public void testSha1UpdateWithString(){
301264
@Test
302265
public void testSha224() throws IOException {
303266
assumeJava8();
304-
assertEquals("d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f", DigestUtils.sha224Hex(""));
267+
assertEquals("d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f",
268+
DigestUtils.digest(MessageDigestAlgorithms.SHA_224,StringUtils.getBytesUtf8("")));
305269
assertEquals("730e109bd7a8a32b1cb9d9a09aa2325d2430587ddbc0c38bad911525",
306-
DigestUtils.sha224Hex("The quick brown fox jumps over the lazy dog"));
270+
DigestUtils.digest(MessageDigestAlgorithms.SHA_224,StringUtils.getBytesUtf8("The quick brown fox jumps over the lazy dog")));
307271

308272
// Examples from FIPS 180-4?
309273
}
@@ -320,8 +284,6 @@ public void testSha256() throws IOException {
320284

321285
assertEquals(DigestUtils.sha256Hex(testData),
322286
DigestUtils.sha256Hex(new ByteArrayInputStream(testData)));
323-
assertEquals(DigestUtils.sha256Hex(testData),
324-
DigestUtils.sha256Hex(ByteBuffer.wrap(testData)));
325287
}
326288

327289
@Test
@@ -339,8 +301,6 @@ public void testSha384() throws IOException {
339301
"hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"));
340302
assertEquals(DigestUtils.sha384Hex(testData),
341303
DigestUtils.sha384Hex(new ByteArrayInputStream(testData)));
342-
assertEquals(DigestUtils.sha384Hex(testData),
343-
DigestUtils.sha384Hex(ByteBuffer.wrap(testData)));
344304
}
345305

346306
@Test
@@ -358,11 +318,6 @@ public void testSha512() throws IOException {
358318
"hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"));
359319
}
360320

361-
@Test
362-
public void testSha512HexByteBuffer() throws IOException {
363-
assertEquals(DigestUtils.sha512Hex(testData), DigestUtils.sha512Hex(ByteBuffer.wrap(testData)));
364-
}
365-
366321
@Test
367322
public void testSha512HexInputStream() throws IOException {
368323
assertEquals(DigestUtils.sha512Hex(testData),

0 commit comments

Comments
 (0)