mirror of
https://github.com/jlengrand/github-api.git
synced 2026-03-10 08:21:21 +00:00
Test that void bridge methods are created
This commit is contained in:
@@ -33,6 +33,7 @@ public class BridgeMethodTest extends Assert {
|
||||
verifyBridgeMethods(GHIssue.class, "getCreatedAt", Date.class, String.class);
|
||||
verifyBridgeMethods(GHIssue.class, "getId", int.class, long.class, String.class);
|
||||
verifyBridgeMethods(GHIssue.class, "getUrl", String.class, URL.class);
|
||||
verifyBridgeMethods(GHIssue.class, "comment", 1, void.class, GHIssueComment.class);
|
||||
|
||||
verifyBridgeMethods(GHOrganization.class, "getHtmlUrl", String.class, URL.class);
|
||||
verifyBridgeMethods(GHOrganization.class, "getId", int.class, long.class, String.class);
|
||||
@@ -55,12 +56,17 @@ public class BridgeMethodTest extends Assert {
|
||||
}
|
||||
|
||||
void verifyBridgeMethods(@Nonnull Class<?> targetClass, @Nonnull String methodName, Class<?>... returnTypes) {
|
||||
verifyBridgeMethods(targetClass, methodName, 0, returnTypes);
|
||||
}
|
||||
|
||||
void verifyBridgeMethods(@Nonnull Class<?> targetClass,
|
||||
@Nonnull String methodName,
|
||||
int parameterCount,
|
||||
Class<?>... returnTypes) {
|
||||
List<Class<?>> foundMethods = new ArrayList<>();
|
||||
Method[] methods = targetClass.getMethods();
|
||||
for (Method method : methods) {
|
||||
if (method.getName().equalsIgnoreCase(methodName)) {
|
||||
// Bridge methods are only
|
||||
assertThat(method.getParameterCount(), equalTo(0));
|
||||
if (method.getName().equalsIgnoreCase(methodName) && method.getParameterCount() == parameterCount) {
|
||||
foundMethods.add(method.getReturnType());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user