-
-
Notifications
You must be signed in to change notification settings - Fork 332
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1018 from bakomchik/bugfix/1013/fix-oom
#1013 uncouple proxy objects from cancellable to make proxy available…
- Loading branch information
Showing
4 changed files
with
43 additions
and
8 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
24 changes: 24 additions & 0 deletions
24
modules/mockk/src/jvmTest/kotlin/io/mockk/it/ProxyWeakReferenceTest.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,24 @@ | ||
package io.mockk.it | ||
|
||
import io.mockk.clearMocks | ||
import io.mockk.every | ||
import io.mockk.spyk | ||
import org.junit.jupiter.api.Test | ||
|
||
class ProxyWeakReferenceTest { | ||
@Test | ||
fun test() { | ||
for (i in 0..1000) { | ||
val spyk = spyk(LazySpringBeanWhichHoldsReferenceForBeanFactory(ByteArray(10 * 1024 * 1024))) | ||
every { spyk.doSmth() } returns "Wow" | ||
spyk.doSmth() | ||
clearMocks(spyk) | ||
} | ||
} | ||
|
||
class LazySpringBeanWhichHoldsReferenceForBeanFactory(val beanFactory: ByteArray) { | ||
fun doSmth(): String { | ||
return "Smth" | ||
} | ||
} | ||
} |