From ae55e6e9f177ac8505298abc0839d82d90dddb38 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Fri, 29 May 2026 17:08:55 +0100 Subject: Support Java method without body --- .../compiler/output/lang/java/JavaWriterTests.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/test') diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/JavaWriterTests.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/JavaWriterTests.java index c349ec1..fd282f9 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/JavaWriterTests.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/JavaWriterTests.java @@ -308,6 +308,23 @@ public class JavaWriterTests { )); } + @Test + public void emptyMethodWithoutBody() throws IOException { + var java = new JavaMethodDeclaration( + "a", + JavaMethodKind.INSTANCE, + JavaTypeRef.VOID, + List.of(), + Optional.empty() + ); + + var string = write(writer -> writer.writeMethodDeclaration(java)); + + assertThat(string, equalTo(""" + public void a();""" + )); + } + @Test public void emptyInstanceMethod() throws IOException { var java = new JavaMethodDeclaration( -- cgit v1.2.3