Azure / Azure/azure-sdk-for-java
Write integration tests for BlobCheckpointStore
- Dominant language
- Java
- Stars
- 2.6k
- Forks
- 2.2k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 159
Description
Mockito is failing to mock blob client on Java 8, so I'm going to disable corresponding unit tests on Java 8 in #43039.
We still need to test `BlobCheckpointStore` on Java 8. We can find a way to rewrite those in a way that'd work with mockito, but given that we don't have integration tests for it, we should just write those.
```log
Mockito cannot mock this class: class com.azure.storage.blob.BlobAsyncClient.
If you're not sure why you're getting this error, please open an issue on GitHub.
Java : 1.8
JVM vendor name : Temurin
JVM vendor version : 25.432-b06
JVM name : OpenJDK 64-Bit Server VM
JVM version : 1.8.0_432-b06
JVM info : mixed mode
OS name : Linux
OS version : 5.15.0-1074-azure
You are seeing this disclaimer because Mockito is configured to create inlined mocks.
You can learn about inline mocks and their limitations under item #39 of the Mockito class javadoc.
Underlying exception : org.mockito.exceptions.base.MockitoException: Could not modify all classes [class com.azure.storage.blob.BlobAsyncClient]
Stack trace
org.mockito.exceptions.base.MockitoException:
Mockito cannot mock this class: class com.azure.storage.blob.BlobAsyncClient.
If you're not sure why you're getting this error, please open an issue on GitHub.
Java : 1.8
JVM vendor name : Temurin
JVM vendor version : 25.432-b06
JVM name : OpenJDK 64-Bit Server VM
JVM version : 1.8.0_432-b06
JVM info : mixed mode
OS name : Linux
OS version : 5.15.0-1074-azure
You are seeing this disclaimer because Mockito is configured to create inlined mocks.
You can learn about inline mocks and their limitations under item #39 of the Mockito class javadoc.
Underlying exception : org.mockito.exceptions.base.MockitoException: Could not modify all classes [class com.azure.storage.blob.BlobAsyncClient]
at com.azure.messaging.eventhubs.checkpointstore.blob.BlobCheckpointStoreTests.beforeEach(BlobCheckpointStoreTests.java:74)
at java.lang.reflect.Method.invoke(Method.java:498)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175)
Caused by: org.mockito.exceptions.base.MockitoException: Could not modify all classes [class com.azure.storage.blob.BlobAsyncClient]
at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:168)
at net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:399)
at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:190)
at net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:410)
... 6 more
Caused by: java.lang.IllegalStateException:
Byte Buddy could not instrument all classes within the mock's type hierarchy
This problem should never occur for javac-compiled classes. This problem has been observed for classes that are:
- Compiled by older versions of scalac
- Classes that are part of the Android distribution
at org.mockito.internal.creation.bytebuddy.InlineBytecodeGenerator.triggerRetransformation(InlineBytecodeGenerator.java:284)
at org.mockito.internal.creation.bytebuddy.InlineBytecodeGenerator.mockClass(InlineBytecodeGenerator.java:217)
at org.mockito.internal.creation.bytebuddy.TypeCachingBytecodeGenerator.lambda$mockClass$0(TypeCachingBytecodeGenerator.java:47)
at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:168)
at net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:399)
at net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:190)
at net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:410)
at org.mockito.internal.creation.bytebuddy.TypeCachingBytecodeGenerator.mockClass(TypeCachingBytecodeGenerator.java:40)
at org.mockito.internal.creation.bytebuddy.InlineDelegateByteBuddyMockMaker.createMockType(InlineDelegateByteBuddyMockMaker.java:396)
at org.mockito.internal.creation.bytebuddy.InlineDelegateByteBuddyMockMaker.doCreateMock(InlineDelegateByteBuddyMockMaker.java:355)
at org.mockito.internal.creation.bytebuddy.InlineDelegateByteBuddyMockMaker.createMock(InlineDelegateByteBuddyMockMaker.java:334)
at org.mockito.internal.creation.bytebuddy.InlineByteBuddyMockMaker.createMock(InlineByteBuddyMockMaker.java:56)
at org.mockito.internal.util.MockUtil.createMock(MockUtil.java:99)
at org.mockito.internal.MockitoCore.mock(MockitoCore.java:88)
at org.mockito.Mockito.mock(Mockito.java:2037)
at org.mockito.internal.configuration.MockAnnotationProcessor.processAnnotationForMock(MockAnnotationProcessor.java:74)
at org.mockito.internal.configuration.MockAnnotationProcessor.process(MockAnnotationProcessor.java:28)
at org.mockito.internal.configuration.MockAnnotationProcessor.process(MockAnnotationProcessor.java:25)
at org.mockito.internal.configuration.IndependentAnnotationEngine.createMockFor(IndependentAnnotationEngine.java:44)
at org.mockito.internal.configuratio
```
Contributor guide
Assessment
This issue has not been assessed yet.