[jira] [Updated] (GEODE-10217) Mockito Unable to Mock org.apache.geode.internal.cache.DiskRegion

2022-04-05 Thread Anilkumar Gingade (Jira)


 [ 
https://issues.apache.org/jira/browse/GEODE-10217?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Anilkumar Gingade updated GEODE-10217:
--
Labels:   (was: needsTriage)

> Mockito Unable to Mock org.apache.geode.internal.cache.DiskRegion
> -
>
> Key: GEODE-10217
> URL: https://issues.apache.org/jira/browse/GEODE-10217
> Project: Geode
>  Issue Type: Bug
>  Components: core, tests
>Reporter: Patrick Johnsn
>Priority: Major
>
> Mokito cannot mock DiskRegion, DiskRegionView, and AbstractDiskRegion because 
> Byte Buddy could not instrument all classes within the mock's type hierarchy.
> {noformat}
> DiskEntryHelperTest > doSynchronousWriteReturnsTrueWhenDiskRegionIsSync FAILED
> 10:19:40org.mockito.exceptions.base.MockitoException: 
> 10:19:40Mockito cannot mock this class: class 
> org.apache.geode.internal.cache.DiskRegion.
> 10:19:40
> 10:19:40If you're not sure why you're getting this error, please report 
> to the mailing list.
> 10:19:40
> 10:19:40
> 10:19:40Java   : 1.8
> 10:19:40JVM vendor name: BellSoft
> 10:19:40JVM vendor version : 25.322-b06
> 10:19:40JVM name   : OpenJDK 64-Bit Server VM
> 10:19:40JVM version: 1.8.0_322-b06
> 10:19:40JVM info   : mixed mode
> 10:19:40OS name: Linux
> 10:19:40OS version : 5.4.0-1069-gcp
> 10:19:40
> 10:19:40
> 10:19:40You are seeing this disclaimer because Mockito is configured to 
> create inlined mocks.
> 10:19:40You can learn about inline mocks and their limitations under item 
> #39 of the Mockito class javadoc.
> 10:19:40
> 10:19:40Underlying exception : 
> org.mockito.exceptions.base.MockitoException: Could not modify all classes 
> [class org.apache.geode.internal.cache.DiskRegion, interface 
> org.apache.geode.internal.cache.persistence.DiskRegionView, class 
> org.apache.geode.internal.cache.AbstractDiskRegion]
> 10:19:40at 
> org.apache.geode.internal.cache.entries.DiskEntryHelperTest.(DiskEntryHelperTest.java:44)
> 10:19:40
> 10:19:40Caused by:
> 10:19:40org.mockito.exceptions.base.MockitoException: Could not 
> modify all classes [class org.apache.geode.internal.cache.DiskRegion, 
> interface org.apache.geode.internal.cache.persistence.DiskRegionView, class 
> org.apache.geode.internal.cache.AbstractDiskRegion]
> 10:19:40at 
> net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:157)
> 10:19:40at 
> net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:371)
> 10:19:40at 
> net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:179)
> 10:19:40at 
> net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:382)
> 10:19:40... 1 more
> 10:19:40
> 10:19:40Caused by:
> 10:19:40java.lang.IllegalStateException: 
> 10:19:40Byte Buddy could not instrument all classes within the 
> mock's type hierarchy
> 10:19:40
> 10:19:40This problem should never occur for javac-compiled 
> classes. This problem has been observed for classes that are:
> 10:19:40 - Compiled by older versions of scalac
> 10:19:40 - Classes that are part of the Android distribution
> 10:19:40at 
> org.mockito.internal.creation.bytebuddy.InlineBytecodeGenerator.triggerRetransformation(InlineBytecodeGenerator.java:280)
> 10:19:40at 
> org.mockito.internal.creation.bytebuddy.InlineBytecodeGenerator.mockClass(InlineBytecodeGenerator.java:213)
> 10:19:40at 
> org.mockito.internal.creation.bytebuddy.TypeCachingBytecodeGenerator.lambda$mockClass$0(TypeCachingBytecodeGenerator.java:47)
> 10:19:40at 
> net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:157)
> 10:19:40at 
> net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:371)
> 10:19:40at 
> net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:179)
> 10:19:40at 
> net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:382)
> 10:19:40at 
> org.mockito.internal.creation.bytebuddy.TypeCachingBytecodeGenerator.mockClass(TypeCachingBytecodeGenerator.java:40)
> 10:19:40at 
> org.mockito.internal.creation.bytebuddy.InlineDelegateByteBuddyMockMaker.createMockType(InlineDelegateByteBuddyMockMaker.java:389)
> 10:19:40at 
> org.mockito.internal.creation.bytebuddy.InlineDelegateByteBuddyMockMaker.doCreateMock(InlineDelegateByteBuddyMockMaker.java:349)
> 10:19:40at 
> org.mockito.internal.creation.bytebuddy.InlineDelegateByteBuddyMockMaker.createMock(InlineDelegateByteBuddyMockMaker.java:328)
> 10:19:40at 
> 

[jira] [Updated] (GEODE-10217) Mockito Unable to Mock org.apache.geode.internal.cache.DiskRegion

2022-04-05 Thread Alexander Murmann (Jira)


 [ 
https://issues.apache.org/jira/browse/GEODE-10217?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Alexander Murmann updated GEODE-10217:
--
Labels: needsTriage  (was: )

> Mockito Unable to Mock org.apache.geode.internal.cache.DiskRegion
> -
>
> Key: GEODE-10217
> URL: https://issues.apache.org/jira/browse/GEODE-10217
> Project: Geode
>  Issue Type: Bug
>  Components: core, tests
>Reporter: Patrick Johnsn
>Priority: Major
>  Labels: needsTriage
>
> Mokito cannot mock DiskRegion, DiskRegionView, and AbstractDiskRegion because 
> Byte Buddy could not instrument all classes within the mock's type hierarchy.
> {noformat}
> DiskEntryHelperTest > doSynchronousWriteReturnsTrueWhenDiskRegionIsSync FAILED
> 10:19:40org.mockito.exceptions.base.MockitoException: 
> 10:19:40Mockito cannot mock this class: class 
> org.apache.geode.internal.cache.DiskRegion.
> 10:19:40
> 10:19:40If you're not sure why you're getting this error, please report 
> to the mailing list.
> 10:19:40
> 10:19:40
> 10:19:40Java   : 1.8
> 10:19:40JVM vendor name: BellSoft
> 10:19:40JVM vendor version : 25.322-b06
> 10:19:40JVM name   : OpenJDK 64-Bit Server VM
> 10:19:40JVM version: 1.8.0_322-b06
> 10:19:40JVM info   : mixed mode
> 10:19:40OS name: Linux
> 10:19:40OS version : 5.4.0-1069-gcp
> 10:19:40
> 10:19:40
> 10:19:40You are seeing this disclaimer because Mockito is configured to 
> create inlined mocks.
> 10:19:40You can learn about inline mocks and their limitations under item 
> #39 of the Mockito class javadoc.
> 10:19:40
> 10:19:40Underlying exception : 
> org.mockito.exceptions.base.MockitoException: Could not modify all classes 
> [class org.apache.geode.internal.cache.DiskRegion, interface 
> org.apache.geode.internal.cache.persistence.DiskRegionView, class 
> org.apache.geode.internal.cache.AbstractDiskRegion]
> 10:19:40at 
> org.apache.geode.internal.cache.entries.DiskEntryHelperTest.(DiskEntryHelperTest.java:44)
> 10:19:40
> 10:19:40Caused by:
> 10:19:40org.mockito.exceptions.base.MockitoException: Could not 
> modify all classes [class org.apache.geode.internal.cache.DiskRegion, 
> interface org.apache.geode.internal.cache.persistence.DiskRegionView, class 
> org.apache.geode.internal.cache.AbstractDiskRegion]
> 10:19:40at 
> net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:157)
> 10:19:40at 
> net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:371)
> 10:19:40at 
> net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:179)
> 10:19:40at 
> net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:382)
> 10:19:40... 1 more
> 10:19:40
> 10:19:40Caused by:
> 10:19:40java.lang.IllegalStateException: 
> 10:19:40Byte Buddy could not instrument all classes within the 
> mock's type hierarchy
> 10:19:40
> 10:19:40This problem should never occur for javac-compiled 
> classes. This problem has been observed for classes that are:
> 10:19:40 - Compiled by older versions of scalac
> 10:19:40 - Classes that are part of the Android distribution
> 10:19:40at 
> org.mockito.internal.creation.bytebuddy.InlineBytecodeGenerator.triggerRetransformation(InlineBytecodeGenerator.java:280)
> 10:19:40at 
> org.mockito.internal.creation.bytebuddy.InlineBytecodeGenerator.mockClass(InlineBytecodeGenerator.java:213)
> 10:19:40at 
> org.mockito.internal.creation.bytebuddy.TypeCachingBytecodeGenerator.lambda$mockClass$0(TypeCachingBytecodeGenerator.java:47)
> 10:19:40at 
> net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:157)
> 10:19:40at 
> net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:371)
> 10:19:40at 
> net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:179)
> 10:19:40at 
> net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:382)
> 10:19:40at 
> org.mockito.internal.creation.bytebuddy.TypeCachingBytecodeGenerator.mockClass(TypeCachingBytecodeGenerator.java:40)
> 10:19:40at 
> org.mockito.internal.creation.bytebuddy.InlineDelegateByteBuddyMockMaker.createMockType(InlineDelegateByteBuddyMockMaker.java:389)
> 10:19:40at 
> org.mockito.internal.creation.bytebuddy.InlineDelegateByteBuddyMockMaker.doCreateMock(InlineDelegateByteBuddyMockMaker.java:349)
> 10:19:40at 
> org.mockito.internal.creation.bytebuddy.InlineDelegateByteBuddyMockMaker.createMock(InlineDelegateByteBuddyMockMaker.java:328)
> 10:19:40