mirror of
https://github.com/google/nomulus.git
synced 2025-07-24 03:30:46 +02:00
Check SQL dependency in super class for SqlIntegrationMembershipTest (#398)
In some cases, we define JpaTransactionManagerRule in a TestCase class which is extended by the concrete test class. So, we need to check if JpaTransactionManagerRule is also defined in the super class.
This commit is contained in:
parent
369c1259fb
commit
988f78274e
1 changed files with 8 additions and 3 deletions
|
@ -71,8 +71,13 @@ public class SqlIntegrationMembershipTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isSqlDependent(Class<?> testClass) {
|
private static boolean isSqlDependent(Class<?> testClass) {
|
||||||
return Stream.of(testClass.getDeclaredFields())
|
for (Class<?> clazz = testClass; clazz != null; clazz = clazz.getSuperclass()) {
|
||||||
.map(Field::getType)
|
if (Stream.of(clazz.getDeclaredFields())
|
||||||
.anyMatch(JpaTransactionManagerRule.class::equals);
|
.map(Field::getType)
|
||||||
|
.anyMatch(JpaTransactionManagerRule.class::equals)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue