mirror of
https://github.com/google/nomulus.git
synced 2025-07-23 11:16:04 +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) {
|
||||
return Stream.of(testClass.getDeclaredFields())
|
||||
.map(Field::getType)
|
||||
.anyMatch(JpaTransactionManagerRule.class::equals);
|
||||
for (Class<?> clazz = testClass; clazz != null; clazz = clazz.getSuperclass()) {
|
||||
if (Stream.of(clazz.getDeclaredFields())
|
||||
.map(Field::getType)
|
||||
.anyMatch(JpaTransactionManagerRule.class::equals)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue