Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jfrantzius committed Apr 16, 2023
1 parent e40026f commit b31d7e7
Showing 1 changed file with 8 additions and 3 deletions.
Expand Up @@ -77,9 +77,14 @@ protected boolean isCompatibleTypes(Type typeToMock, Type mockType, Field inject

private Stream<Type> getSuperTypes(Class<?> concreteMockClass) {
Stream<Type> mockInterfaces = Arrays.stream(concreteMockClass.getGenericInterfaces());
Stream<Type> mockSuperTypes =
Stream.concat(mockInterfaces, Stream.of(concreteMockClass.getGenericSuperclass()));
return mockSuperTypes;
Type genericSuperclass = concreteMockClass.getGenericSuperclass();
// for java.lang.Object, genericSuperclass is null
if (genericSuperclass!=null) {
Stream<Type> mockSuperTypes = Stream.concat(mockInterfaces, Stream.of(genericSuperclass));
return mockSuperTypes;
} else {
return mockInterfaces;
}
}

private boolean recurseOnTypeArguments(
Expand Down

0 comments on commit b31d7e7

Please sign in to comment.