HBASE-25370 Fix flaky test TestClassFinder#testClassFinderDefaultsToOwnPackage (#2740)
Signed-off-by: Duo Zhang <zhangduo@apache.org>
This commit is contained in:
parent
210d8a7b56
commit
9c2f1f7a2b
|
@ -210,6 +210,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,7 +17,8 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.hadoop.hbase;
|
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.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
@ -295,7 +296,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 {
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -2114,13 +2114,11 @@
|
||||||
<groupId>org.hamcrest</groupId>
|
<groupId>org.hamcrest</groupId>
|
||||||
<artifactId>hamcrest-core</artifactId>
|
<artifactId>hamcrest-core</artifactId>
|
||||||
<version>${hamcrest.version}</version>
|
<version>${hamcrest.version}</version>
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.hamcrest</groupId>
|
<groupId>org.hamcrest</groupId>
|
||||||
<artifactId>hamcrest-library</artifactId>
|
<artifactId>hamcrest-library</artifactId>
|
||||||
<version>${hamcrest.version}</version>
|
<version>${hamcrest.version}</version>
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mockito</groupId>
|
<groupId>org.mockito</groupId>
|
||||||
|
|
Loading…
Reference in New Issue