Speedup MessageDigestTests#testToHexString

The purpose of this commit is to speed up the runtime of
MessageDigestTests#testToHexString. As written, the test contains a loop
that creates 1024 test cases leading to a test runtime on the order of a
few seconds. Given build infrastructure, a single test case should
suffice. Therefore, this commit removes this loop so that the test can
execute on the order of a couple hundred milliseconds.
This commit is contained in:
Jason Tedor 2016-02-08 10:54:50 -05:00
parent bf382ce5d8
commit cbeae225b9
1 changed files with 9 additions and 11 deletions

View File

@ -59,7 +59,6 @@ public class MessageDigestsTests extends ESTestCase {
} }
public void testToHexString() throws Exception { public void testToHexString() throws Exception {
for (int i = 0; i < 1024; i++) {
BigInteger expected = BigInteger.probablePrime(256, random()); BigInteger expected = BigInteger.probablePrime(256, random());
byte[] bytes = expected.toByteArray(); byte[] bytes = expected.toByteArray();
String hex = MessageDigests.toHexString(bytes); String hex = MessageDigests.toHexString(bytes);
@ -70,5 +69,4 @@ public class MessageDigestsTests extends ESTestCase {
BigInteger actual = new BigInteger(hex, 16); BigInteger actual = new BigInteger(hex, 16);
assertEquals(expected, actual); assertEquals(expected, actual);
} }
}
} }