You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zh...@apache.org on 2020/12/11 00:26:58 UTC
[hbase] branch branch-2.3 updated: HBASE-25370 Fix flaky test
TestClassFinder#testClassFinderDefaultsToOwnPackage (#2740)
This is an automated email from the ASF dual-hosted git repository.
zhangduo pushed a commit to branch branch-2.3
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2.3 by this push:
new 94ce48b HBASE-25370 Fix flaky test TestClassFinder#testClassFinderDefaultsToOwnPackage (#2740)
94ce48b is described below
commit 94ce48b173d7984c5a4034ae5ddcd331f627c68e
Author: Adam <37...@users.noreply.github.com>
AuthorDate: Thu Dec 10 08:28:21 2020 -0600
HBASE-25370 Fix flaky test TestClassFinder#testClassFinderDefaultsToOwnPackage (#2740)
Signed-off-by: Duo Zhang <zh...@apache.org>
---
hbase-common/pom.xml | 5 +++++
.../src/test/java/org/apache/hadoop/hbase/TestClassFinder.java | 8 ++++++--
pom.xml | 2 --
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/hbase-common/pom.xml b/hbase-common/pom.xml
index 4a64ec8..d804fac 100644
--- a/hbase-common/pom.xml
+++ b/hbase-common/pom.xml
@@ -211,6 +211,11 @@
<optional>true</optional>
</dependency>
<dependency>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest-library</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
diff --git a/hbase-common/src/test/java/org/apache/hadoop/hbase/TestClassFinder.java b/hbase-common/src/test/java/org/apache/hadoop/hbase/TestClassFinder.java
index b1c0903..cf97e31 100644
--- a/hbase-common/src/test/java/org/apache/hadoop/hbase/TestClassFinder.java
+++ b/hbase-common/src/test/java/org/apache/hadoop/hbase/TestClassFinder.java
@@ -17,7 +17,8 @@
*/
package org.apache.hadoop.hbase;
-import static org.junit.Assert.assertArrayEquals;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.arrayContainingInAnyOrder;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@@ -295,7 +296,10 @@ public class TestClassFinder {
Set<Class<?>> pkgClasses = allClassesFinder.findClasses(
ClassFinder.class.getPackage().getName(), false);
Set<Class<?>> defaultClasses = allClassesFinder.findClasses(false);
- assertArrayEquals(pkgClasses.toArray(), defaultClasses.toArray());
+ Object[] pkgClassesArray = pkgClasses.toArray();
+ Object[] defaultClassesArray = defaultClasses.toArray();
+ assertEquals(pkgClassesArray.length, defaultClassesArray.length);
+ assertThat(pkgClassesArray, arrayContainingInAnyOrder(defaultClassesArray));
}
private static class FileAndPath {
diff --git a/pom.xml b/pom.xml
index e33a277..ca32beb 100755
--- a/pom.xml
+++ b/pom.xml
@@ -2119,13 +2119,11 @@
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>${hamcrest.version}</version>
- <scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>${hamcrest.version}</version>
- <scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>