Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test with UseMainMethod.Always do not work with Kotlin main functions #33114

Closed
PedroAlvarado opened this issue Nov 12, 2022 · 0 comments
Closed
Assignees
Labels
type: bug A general bug
Milestone

Comments

@PedroAlvarado
Copy link

PedroAlvarado commented Nov 12, 2022

When using Kotlin, the SpringBootTest.UseMainMethod.ALWAYS option is unable to locate the main method. The main/blocker issue here is not being able to use the ApplicationContextInitializers that are added in the main method.

Caused by: java.lang.IllegalStateException: Main method not found on 'com.example.demo.DemoApplication'
	at org.springframework.util.Assert.state(Assert.java:97)
	at org.springframework.boot.test.context.SpringBootContextLoader.getMainMethod(SpringBootContextLoader.java:156)
	at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:125)
	at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:105)
	at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:183)
	at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:117)
	... 87 more
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 12, 2022
@philwebb philwebb added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Nov 14, 2022
@philwebb philwebb added this to the 3.0.x milestone Nov 14, 2022
@philwebb philwebb self-assigned this Nov 16, 2022
@philwebb philwebb changed the title UseMainMethod.Always not working with Kotlin Test with UseMainMethod.Always do not work with Kotlin main functions Nov 16, 2022
@philwebb philwebb modified the milestones: 3.0.x, 3.0.0 Nov 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants