You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When mocking software.amazon.awssdk.services.s3.S3Client with Mockito its not possible to verify PutObjectResponse putObject(PutObjectRequest putObjectRequest, RequestBody requestBody)-method.
Following error-message is appearing: Caused by: Argument(s) are different! Wanted: s3Client.putObject( PutObjectRequest(Bucket=***, Key=***), software.amazon.awssdk.core.sync.RequestBody@2591f310 ); -> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) Actual invocations have different arguments: s3Client.putObject( PutObjectRequest(Bucket=***, Key=***), software.amazon.awssdk.core.sync.RequestBody@4bbddcc8 );
Expected Behavior
Verifying putObject()-method should run without erros when arguments are equal.
This is a simple example. In my real code I had a class which is using S3Client to store files in S3. I tested a method of my class and verified putObject()-method from s3Client like in the example above.
Possible Solution
Implement equals()-method in software.amazon.awssdk.core.sync.RequestBody.
Additional Information/Context
I would like to work on this. You can assign it to me.
AWS Java SDK version used
2.17.73
JDK version used
14.0.1
Operating System and version
Windows 10
The text was updated successfully, but these errors were encountered:
Thank you very much for your submission.
We always welcome PR from the community on new features for the AWS Java SDK.
However, since RequestBody has an inputStream, we will end up reading the input stream every time while doing the Equals. Thus implementing equals in RequestBody might end up unnecessary reading of inputStreams and is not a solution we would consider in this case.
We recommend that you use the same requestBody instead of creating a new one while verifying.
Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.
Describe the bug
When mocking
software.amazon.awssdk.services.s3.S3Client
with Mockito its not possible to verifyPutObjectResponse putObject(PutObjectRequest putObjectRequest, RequestBody requestBody)
-method.Following error-message is appearing:
Caused by: Argument(s) are different! Wanted: s3Client.putObject( PutObjectRequest(Bucket=***, Key=***), software.amazon.awssdk.core.sync.RequestBody@2591f310 ); -> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) Actual invocations have different arguments: s3Client.putObject( PutObjectRequest(Bucket=***, Key=***), software.amazon.awssdk.core.sync.RequestBody@4bbddcc8 );
Expected Behavior
Verifying putObject()-method should run without erros when arguments are equal.
Current Behavior
An error occures despite arguments are equal.
Reproduction Steps
Example Test:
This is a simple example. In my real code I had a class which is using S3Client to store files in S3. I tested a method of my class and verified putObject()-method from s3Client like in the example above.
Possible Solution
Implement equals()-method in
software.amazon.awssdk.core.sync.RequestBody
.Additional Information/Context
I would like to work on this. You can assign it to me.
AWS Java SDK version used
2.17.73
JDK version used
14.0.1
Operating System and version
Windows 10
The text was updated successfully, but these errors were encountered: