HHH-11428 - When multiple @RequiresDialect annotation is applied the test is ignored
This commit is contained in:
parent
bb0b3e8c43
commit
f007dc7c90
|
@ -261,25 +261,13 @@ public class CustomRunner extends BlockJUnit4ClassRunner {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean foundMatch = false;
|
|
||||||
// @RequiresDialects & @RequiresDialect
|
// @RequiresDialects & @RequiresDialect
|
||||||
final List<RequiresDialect> requiresDialects = Helper.collectAnnotations(
|
final List<RequiresDialect> requiresDialects = Helper.collectAnnotations(
|
||||||
RequiresDialect.class, RequiresDialects.class, frameworkMethod, getTestClass()
|
RequiresDialect.class, RequiresDialects.class, frameworkMethod, getTestClass()
|
||||||
);
|
);
|
||||||
for ( RequiresDialect requiresDialectAnn : requiresDialects ) {
|
|
||||||
for ( Class<? extends Dialect> dialectClass : requiresDialectAnn.value() ) {
|
if ( !requiresDialects.isEmpty() && !isDialectMatchingRequired( requiresDialects ) ) {
|
||||||
foundMatch = requiresDialectAnn.strictMatching()
|
|
||||||
? dialectClass.equals( dialect.getClass() )
|
|
||||||
: dialectClass.isInstance( dialect );
|
|
||||||
if ( foundMatch ) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( foundMatch ) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( !foundMatch ) {
|
|
||||||
return buildIgnore( requiresDialects );
|
return buildIgnore( requiresDialects );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,6 +296,24 @@ public class CustomRunner extends BlockJUnit4ClassRunner {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isDialectMatchingRequired(List<RequiresDialect> requiresDialects) {
|
||||||
|
boolean foundMatch = false;
|
||||||
|
for ( RequiresDialect requiresDialectAnn : requiresDialects ) {
|
||||||
|
for ( Class<? extends Dialect> dialectClass : requiresDialectAnn.value() ) {
|
||||||
|
foundMatch = requiresDialectAnn.strictMatching()
|
||||||
|
? dialectClass.equals( dialect.getClass() )
|
||||||
|
: dialectClass.isInstance( dialect );
|
||||||
|
if ( foundMatch ) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( foundMatch ) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return foundMatch;
|
||||||
|
}
|
||||||
|
|
||||||
private Ignore buildIgnore(Skip skip) {
|
private Ignore buildIgnore(Skip skip) {
|
||||||
return new IgnoreImpl( "@Skip : " + skip.message() );
|
return new IgnoreImpl( "@Skip : " + skip.message() );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue