Skip to content

Commit

Permalink
test(core): use autoconfiguration instead of manually defined context…
Browse files Browse the repository at this point in the history
… in integration tests (#404)

Co-authored-by: Timon Back <[email protected]>
  • Loading branch information
sam0r040 and timonback authored Oct 13, 2023
1 parent 182b13c commit ac5c244
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,7 @@
package io.github.stavshamir.springwolf;

import io.github.stavshamir.springwolf.asyncapi.AsyncApiService;
import io.github.stavshamir.springwolf.asyncapi.DefaultAsyncApiSerializerService;
import io.github.stavshamir.springwolf.asyncapi.DefaultAsyncApiService;
import io.github.stavshamir.springwolf.asyncapi.DefaultChannelsService;
import io.github.stavshamir.springwolf.configuration.DefaultAsyncApiDocketService;
import io.github.stavshamir.springwolf.configuration.properties.SpringwolfConfigProperties;
import io.github.stavshamir.springwolf.fixtures.MinimalTestContextConfiguration;
import io.github.stavshamir.springwolf.schemas.DefaultSchemasService;
import io.github.stavshamir.springwolf.schemas.example.ExampleJsonGenerator;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
Expand All @@ -27,15 +20,8 @@ public class SpringContextIntegrationTest {
@Nested
@ContextConfiguration(
classes = {
SpringwolfConfigProperties.class,
SpringwolfAutoConfiguration.class,
CustomBeanAsyncApiDocketConfiguration.class, // user has defined an own AsyncApiDocket bean
DefaultAsyncApiDocketService.class,
DefaultAsyncApiService.class,
DefaultChannelsService.class,
DefaultSchemasService.class,
ExampleJsonGenerator.class,
DefaultAsyncApiService.class,
DefaultAsyncApiSerializerService.class,
})
class AsyncApiDocketTest {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
package io.github.stavshamir.springwolf.fixtures;

import io.github.stavshamir.springwolf.asyncapi.DefaultAsyncApiSerializerService;
import io.github.stavshamir.springwolf.asyncapi.DefaultAsyncApiService;
import io.github.stavshamir.springwolf.asyncapi.DefaultChannelsService;
import io.github.stavshamir.springwolf.configuration.DefaultAsyncApiDocketService;
import io.github.stavshamir.springwolf.configuration.properties.SpringwolfConfigProperties;
import io.github.stavshamir.springwolf.schemas.DefaultSchemasService;
import io.github.stavshamir.springwolf.schemas.example.ExampleJsonGenerator;
import io.github.stavshamir.springwolf.SpringwolfAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
Expand All @@ -17,17 +11,8 @@
import static java.lang.annotation.RetentionPolicy.RUNTIME;

@Retention(RUNTIME)
@ContextConfiguration(
classes = {
DefaultAsyncApiDocketService.class,
DefaultAsyncApiService.class,
DefaultChannelsService.class,
DefaultSchemasService.class,
ExampleJsonGenerator.class,
DefaultAsyncApiService.class,
DefaultAsyncApiSerializerService.class,
})
@EnableConfigurationProperties(SpringwolfConfigProperties.class)
@ContextConfiguration(classes = {SpringwolfAutoConfiguration.class})
@EnableConfigurationProperties
@TestPropertySource(
properties = {
"springwolf.enabled=true",
Expand Down

0 comments on commit ac5c244

Please sign in to comment.