HBASE-25370 Fix flaky test TestClassFinder#testClassFinderDefaultsToOwnPackage (#2740)
Signed-off-by: Duo Zhang <zhangduo@apache.org>
This commit is contained in:
parent
635c911532
commit
c62c18dca7
|
@ -211,6 +211,11 @@
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.hamcrest</groupId>
|
||||||
|
<artifactId>hamcrest-library</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mockito</groupId>
|
<groupId>org.mockito</groupId>
|
||||||
<artifactId>mockito-core</artifactId>
|
<artifactId>mockito-core</artifactId>
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.hadoop.hbase;
|
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.assertArrayEquals;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
|
@ -295,7 +297,10 @@ public class TestClassFinder {
|
||||||
Set<Class<?>> pkgClasses = allClassesFinder.findClasses(
|
Set<Class<?>> pkgClasses = allClassesFinder.findClasses(
|
||||||
ClassFinder.class.getPackage().getName(), false);
|
ClassFinder.class.getPackage().getName(), false);
|
||||||
Set<Class<?>> defaultClasses = allClassesFinder.findClasses(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 {
|
private static class FileAndPath {
|
||||||
|
|
Loading…
Reference in New Issue