-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Take superclasses into account when looking up main method
- Loading branch information
Showing
3 changed files
with
165 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...ent/src/test/java/io/quarkus/commandmode/InstanceMainInSuperClassCommandModeTestCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package io.quarkus.commandmode; | ||
|
||
import org.assertj.core.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.runtime.annotations.QuarkusMain; | ||
import io.quarkus.test.QuarkusProdModeTest; | ||
|
||
public class InstanceMainInSuperClassCommandModeTestCase { | ||
@RegisterExtension | ||
static final QuarkusProdModeTest config = new QuarkusProdModeTest() | ||
.withApplicationRoot((jar) -> jar | ||
.addClasses(HelloWorldSuperSuper.class, HelloWorldSuper.class, HelloWorldMain.class)) | ||
.setApplicationName("run-exit") | ||
.setApplicationVersion("0.1-SNAPSHOT") | ||
.setExpectExit(true) | ||
.setRun(true); | ||
|
||
@Test | ||
public void testRun() { | ||
Assertions.assertThat(config.getStartupConsoleOutput()).contains("Hello World"); | ||
Assertions.assertThat(config.getExitCode()).isEqualTo(0); | ||
} | ||
|
||
@QuarkusMain | ||
public static class HelloWorldMain extends HelloWorldSuper { | ||
|
||
} | ||
|
||
public static class HelloWorldSuperSuper { | ||
|
||
protected void main() { | ||
System.out.println("Hello World"); | ||
} | ||
} | ||
|
||
public static class HelloWorldSuper extends HelloWorldSuperSuper { | ||
|
||
protected void main2() { | ||
System.out.println("Hello"); | ||
} | ||
} | ||
|
||
} |
42 changes: 42 additions & 0 deletions
42
...c/test/java/io/quarkus/commandmode/InstanceMainInSuperClassNoArgsCommandModeTestCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package io.quarkus.commandmode; | ||
|
||
import org.assertj.core.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.runtime.annotations.QuarkusMain; | ||
import io.quarkus.test.QuarkusProdModeTest; | ||
|
||
public class InstanceMainInSuperClassNoArgsCommandModeTestCase { | ||
@RegisterExtension | ||
static final QuarkusProdModeTest config = new QuarkusProdModeTest() | ||
.withApplicationRoot((jar) -> jar | ||
.addClasses(HelloWorldSuper.class, HelloWorldMain.class)) | ||
.setApplicationName("run-exit") | ||
.setApplicationVersion("0.1-SNAPSHOT") | ||
.setExpectExit(true) | ||
.setRun(true); | ||
|
||
@Test | ||
public void testRun() { | ||
Assertions.assertThat(config.getStartupConsoleOutput()).contains("Hello World"); | ||
Assertions.assertThat(config.getExitCode()).isEqualTo(0); | ||
} | ||
|
||
@QuarkusMain | ||
public static class HelloWorldMain extends HelloWorldSuper { | ||
|
||
} | ||
|
||
public static class HelloWorldSuper { | ||
|
||
void main() { | ||
System.out.println("Hello World"); | ||
} | ||
|
||
void main2() { | ||
System.out.println("Hello"); | ||
} | ||
} | ||
|
||
} |