-
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.
Scheduler - detect scheduled methods of the same name on a class
- fix #31547
- Loading branch information
Showing
3 changed files
with
50 additions
and
2 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
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
36 changes: 36 additions & 0 deletions
36
.../src/test/java/io/quarkus/scheduler/test/MultipleScheduledMethodsWithTheSameNameTest.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,36 @@ | ||
package io.quarkus.scheduler.test; | ||
|
||
import jakarta.enterprise.inject.spi.DeploymentException; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.scheduler.Scheduled; | ||
import io.quarkus.scheduler.ScheduledExecution; | ||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
public class MultipleScheduledMethodsWithTheSameNameTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest test = new QuarkusUnitTest() | ||
.setExpectedException(DeploymentException.class) | ||
.withApplicationRoot((jar) -> jar | ||
.addClasses(BeanWithInvalidScheduledMethods.class)); | ||
|
||
@Test | ||
public void test() throws InterruptedException { | ||
} | ||
|
||
static class BeanWithInvalidScheduledMethods { | ||
|
||
@Scheduled(cron = "0/1 * * * * ?") | ||
void foo() { | ||
} | ||
|
||
@Scheduled(every = "10s") | ||
void foo(ScheduledExecution execution) { | ||
} | ||
|
||
} | ||
|
||
} |