From 4ecffb5feeb308adcf070a14c47d38e66b8a7602 Mon Sep 17 00:00:00 2001 From: aherbert Date: Tue, 18 Feb 2020 13:47:24 +0000 Subject: [PATCH] Test getProvider() is Apache Commons Collections. --- .../collections4/bloomfilter/hasher/function/MD5Cyclic.java | 3 ++- .../bloomfilter/hasher/function/MD5CyclicTest.java | 1 + .../bloomfilter/hasher/function/Murmur128x86CyclicTest.java | 1 + .../bloomfilter/hasher/function/Murmur32x86IterativeTest.java | 1 + .../bloomfilter/hasher/function/ObjectsHashIterativeTest.java | 1 + 5 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/function/MD5Cyclic.java b/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/function/MD5Cyclic.java index d2aeb4913..f6d4e5945 100644 --- a/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/function/MD5Cyclic.java +++ b/src/main/java/org/apache/commons/collections4/bloomfilter/hasher/function/MD5Cyclic.java @@ -59,7 +59,8 @@ public final class MD5Cyclic implements HashFunction { try { messageDigest = MessageDigest.getInstance(NAME); } catch (final NoSuchAlgorithmException e) { - throw new IllegalStateException(e.getMessage()); + // This should not happen + throw new IllegalStateException("Missing the standard MD5 message digest algorithm", e); } signature = apply(HashFunctionIdentity.prepareSignatureBuffer(this), 0); } diff --git a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/function/MD5CyclicTest.java b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/function/MD5CyclicTest.java index d82ea8a02..069a299bf 100644 --- a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/function/MD5CyclicTest.java +++ b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/function/MD5CyclicTest.java @@ -58,5 +58,6 @@ public class MD5CyclicTest { md5.getProcessType()); final long expected = md5.apply(arg.getBytes(StandardCharsets.UTF_8), 0); assertEquals(expected, md5.getSignature()); + assertEquals("Apache Commons Collections", md5.getProvider()); } } diff --git a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/function/Murmur128x86CyclicTest.java b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/function/Murmur128x86CyclicTest.java index 35fc1c731..d318b9c9e 100644 --- a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/function/Murmur128x86CyclicTest.java +++ b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/function/Murmur128x86CyclicTest.java @@ -60,5 +60,6 @@ public class Murmur128x86CyclicTest { murmur.getProcessType()); final long expected = murmur.apply(arg.getBytes(StandardCharsets.UTF_8), 0); assertEquals(expected, murmur.getSignature()); + assertEquals("Apache Commons Collections", murmur.getProvider()); } } diff --git a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/function/Murmur32x86IterativeTest.java b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/function/Murmur32x86IterativeTest.java index efe6da21f..daf511a5a 100644 --- a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/function/Murmur32x86IterativeTest.java +++ b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/function/Murmur32x86IterativeTest.java @@ -58,5 +58,6 @@ public class Murmur32x86IterativeTest { murmur.getProcessType()); final long expected = murmur.apply(arg.getBytes(StandardCharsets.UTF_8), 0); assertEquals(expected, murmur.getSignature()); + assertEquals("Apache Commons Collections", murmur.getProvider()); } } diff --git a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/function/ObjectsHashIterativeTest.java b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/function/ObjectsHashIterativeTest.java index 4df7f7534..1f7224d7b 100644 --- a/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/function/ObjectsHashIterativeTest.java +++ b/src/test/java/org/apache/commons/collections4/bloomfilter/hasher/function/ObjectsHashIterativeTest.java @@ -63,5 +63,6 @@ public class ObjectsHashIterativeTest { final long expected2 = obj.apply(arg.getBytes(StandardCharsets.UTF_8), 0); assertEquals(expected, expected2); assertEquals(expected, obj.getSignature()); + assertEquals("Apache Commons Collections", obj.getProvider()); } }