-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test to make sure that the fallback bean exists in the context
- Loading branch information
1 parent
22e57dd
commit 4cef524
Showing
3 changed files
with
33 additions
and
0 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
30 changes: 30 additions & 0 deletions
30
kafka/src/test/groovy/docs/producer/fallback/MessageClientFallbackSpec.groovy
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,30 @@ | ||
package docs.producer.fallback | ||
|
||
import io.micronaut.context.ApplicationContext | ||
import io.micronaut.context.annotation.Property | ||
import io.micronaut.test.extensions.spock.annotation.MicronautTest | ||
import jakarta.inject.Inject | ||
import spock.lang.Specification | ||
|
||
@MicronautTest | ||
@Property(name = "spec.name", value = "MessageClientFallbackSpec") | ||
@Property(name = "kafka.enabled", value = "false") | ||
class MessageClientFallbackSpec extends Specification { | ||
|
||
@Inject | ||
ApplicationContext context | ||
|
||
void "test that context contains the fallback bean"() { | ||
when: | ||
MessageClientFallback bean = context.getBean(MessageClientFallback) | ||
|
||
then: | ||
bean != null | ||
|
||
when: | ||
bean.send('message') | ||
|
||
then: | ||
thrown(UnsupportedOperationException) | ||
} | ||
} |