HBASE-23695 Fail gracefully if no category is present

Signed-off-by: Wellington Chevreuil <wchevreuil@apache.org>

Closes #1052
This commit is contained in:
Josh Elser 2020-01-15 14:26:34 -05:00
parent 68d3c201dd
commit 0935ba4e16
1 changed files with 6 additions and 3 deletions

View File

@ -41,9 +41,12 @@ public class HBaseClassTestRuleChecker extends RunListener {
@Override
public void testStarted(Description description) throws Exception {
Category[] categories = description.getTestClass().getAnnotationsByType(Category.class);
for (Class<?> c : categories[0].value()) {
if (c == IntegrationTests.class) {
return;
// Don't fail if there is a missing category
if (categories.length > 0) {
for (Class<?> c : categories[0].value()) {
if (c == IntegrationTests.class) {
return;
}
}
}
for (Field field : description.getTestClass().getFields()) {