Skip to content

Commit bd50907

Browse files
authored
Merge pull request #1052 from bitwiseman/task/test-void-bridge
Test that void bridge methods are created
2 parents 6d86cfb + a8c7c97 commit bd50907

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/test/java/org/kohsuke/github/BridgeMethodTest.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public void testBridgeMethods() throws IOException {
3333
verifyBridgeMethods(GHIssue.class, "getCreatedAt", Date.class, String.class);
3434
verifyBridgeMethods(GHIssue.class, "getId", int.class, long.class, String.class);
3535
verifyBridgeMethods(GHIssue.class, "getUrl", String.class, URL.class);
36+
verifyBridgeMethods(GHIssue.class, "comment", 1, void.class, GHIssueComment.class);
3637

3738
verifyBridgeMethods(GHOrganization.class, "getHtmlUrl", String.class, URL.class);
3839
verifyBridgeMethods(GHOrganization.class, "getId", int.class, long.class, String.class);
@@ -55,12 +56,17 @@ public void testBridgeMethods() throws IOException {
5556
}
5657

5758
void verifyBridgeMethods(@Nonnull Class<?> targetClass, @Nonnull String methodName, Class<?>... returnTypes) {
59+
verifyBridgeMethods(targetClass, methodName, 0, returnTypes);
60+
}
61+
62+
void verifyBridgeMethods(@Nonnull Class<?> targetClass,
63+
@Nonnull String methodName,
64+
int parameterCount,
65+
Class<?>... returnTypes) {
5866
List<Class<?>> foundMethods = new ArrayList<>();
5967
Method[] methods = targetClass.getMethods();
6068
for (Method method : methods) {
61-
if (method.getName().equalsIgnoreCase(methodName)) {
62-
// Bridge methods are only
63-
assertThat(method.getParameterCount(), equalTo(0));
69+
if (method.getName().equalsIgnoreCase(methodName) && method.getParameterCount() == parameterCount) {
6470
foundMethods.add(method.getReturnType());
6571
}
6672
}

0 commit comments

Comments
 (0)