Skip to content

Conversation

@sekikn
Copy link

@sekikn sekikn commented Dec 5, 2025

Description

  • This PR fixes the generated Maven project not to ignore the unit tests. I tested it as follows:
$ asyncapi generate fromTemplate tests/mocks/kafka.yml . -o /tmp/kafka -p maven=true
$ cd /tmp/kafka
$ mvn clean install

(snip)

[INFO] --- surefire:3.5.4:test (default-test) @ untitled ---
[INFO] Using configured provider org.apache.maven.surefire.junit4.JUnit4Provider
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.asyncapi.SimpleKafkaTest

(snip)

[INFO] 
[INFO] Results:
[INFO] 
[ERROR] Errors: 
[ERROR]   ApplicationTests.contextLoads » IllegalState Failed to load ApplicationContext for [MergedContextConfiguration@1952ad9d testClass = com.asyncapi.ApplicationTests, locations = [], classes = [com.asyncapi.Application], contextInitializerClasses = [], activeProfiles = [], propertySourceLocations = [], propertySourceProperties = ["org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true"], contextCustomizers = [org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@9d5509a, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@7eac9008, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@5dda768f, org.springframework.boot.test.autoconfigure.actuate.observability.ObservabilityContextCustomizerFactory$DisableObservabilityContextCustomizer@1f, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizer@6200f9cb, org.springframework.boot.test.context.SpringBootTestAnnotation@e789c798], contextLoader = org.springframework.boot.test.context.SpringBootContextLoader, parent = null]
[ERROR]   TestcontainerKafkaTest » IllegalState Could not find a valid Docker environment. Please see logs and check configuration
[INFO] 
[ERROR] Tests run: 4, Failures: 0, Errors: 2, Skipped: 0

(2 tests out of 4 failed in the example above, but they are different issues from #459. One should be fixed once #456 is merged, and the other will be addressed in another PR)

Related issue(s)

Resolves #459

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Generated tests are not executed in a Maven project

1 participant