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/10 14:28:39 UTC
[hbase] branch master 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 master
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/master by this push:
new c62c18d HBASE-25370 Fix flaky test TestClassFinder#testClassFinderDefaultsToOwnPackage (#2740)
c62c18d is described below
commit c62c18dca7154294ac8c76f922a8fb4cd3e3f936
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 | 7 ++++++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/hbase-common/pom.xml b/hbase-common/pom.xml
index 48b3c0b..8b91541 100644
--- a/hbase-common/pom.xml
+++ b/hbase-common/pom.xml
@@ -212,6 +212,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..411bb65 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,6 +17,8 @@
*/
package org.apache.hadoop.hbase;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.arrayContainingInAnyOrder;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -295,7 +297,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 {