Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(amazon_sqs_subscriber): moved AmazonSQSSubscriberSpec (groovy) unit test to AmazonSQSSubscriberTest (java) #1428

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

aman-agrawal
Copy link

@aman-agrawal aman-agrawal commented Jun 15, 2024

  • moved AmazonSQSSubscriberSpec (groovy) unit test to AmazonSQSSubscriberTest (java)
  • Newly added TC is passing in AmazonSQSSubscriberTest
  • deleted AmazonSQSSubscriberSpec
  • changed unmarshalMessageBody() from private to package-private (default) to access it in TC & added @VisibleForTesting
  • added org.mockito:mockito-inline to support creation of static mocks

String result = subject.unmarshalMessageBody(snsMessage);

// Then
verify(log, never()).error(anyString(), anyString(), any(IOException.class));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't look correct. The groovy code uses subject.log

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when we are using subject.log in verify(subject.log, never()).error(anyString(), anyString(), any(IOException.class));
we got below error:
Argument passed to verify() is of type Logger and is not a mock!

…y) unit test to AmazonSQSSubscriberTest (java)
@@ -25,4 +25,5 @@ dependencies {
implementation "io.spinnaker.kork:kork-pubsub-aws"
implementation "com.netflix.spectator:spectator-api"
implementation "javax.validation:validation-api"
testImplementation "org.mockito:mockito-inline"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this dependency to support the creation of static mocks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants