Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
33bdce3
commit 923df7b
Showing
7 changed files
with
76 additions
and
5 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
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
sentry-spring/src/test/kotlin/io/sentry/spring/SentryInitBeanPostProcessorTest.kt
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 io.sentry.spring | ||
|
||
import com.nhaarman.mockitokotlin2.mock | ||
import com.nhaarman.mockitokotlin2.verify | ||
import io.sentry.IHub | ||
import org.springframework.context.annotation.AnnotationConfigApplicationContext | ||
import org.springframework.context.annotation.Bean | ||
import org.springframework.context.annotation.Configuration | ||
import kotlin.test.Test | ||
|
||
class SentryInitBeanPostProcessorTest { | ||
|
||
@Test | ||
fun closesSentryOnApplicationContextDestroy() { | ||
val ctx = AnnotationConfigApplicationContext(TestConfig::class.java) | ||
val hub = ctx.getBean(IHub::class.java) | ||
ctx.close() | ||
verify(hub).close() | ||
} | ||
|
||
@Configuration | ||
open class TestConfig { | ||
|
||
@Bean(destroyMethod = "") | ||
open fun hub() = mock<IHub>() | ||
|
||
@Bean | ||
open fun sentryInitBeanPostProcessor() = SentryInitBeanPostProcessor(hub()) | ||
} | ||
} |
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
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