-
Notifications
You must be signed in to change notification settings - Fork 467
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
Fixing issue with ResourceNotFound around SubscribeToShard #359
Conversation
* Calling onNext and onComplete if throwable is of the kind ResourceNotFound. * Adding testing for ResourceNotFound * Updating version to 2.0.1-SNAPSHOT
* Throwing exception from RecordFlow.exceptionOccured
.forClass(FanOutRecordsPublisher.RecordFlow.class); | ||
ArgumentCaptor<ProcessRecordsInput> inputCaptor = ArgumentCaptor.forClass(ProcessRecordsInput.class); | ||
|
||
Subscriber<ProcessRecordsInput> subscriber = spy(new Subscriber<ProcessRecordsInput>() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spies are generally not recommended, you should be able to use a mock here.
@@ -124,9 +126,19 @@ private void errorOccurred(RecordFlow triggeringFlow, Throwable t) { | |||
outstandingRequests = 0; | |||
|
|||
try { | |||
subscriber.onError(t); | |||
if (t.getCause() instanceof ResourceNotFoundException) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move this into a method?
@@ -124,9 +126,19 @@ private void errorOccurred(RecordFlow triggeringFlow, Throwable t) { | |||
outstandingRequests = 0; | |||
|
|||
try { | |||
subscriber.onError(t); | |||
if (t.getCause() instanceof ResourceNotFoundException) { | |||
log.warn( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't need to be a warning, as it's handled.
* Creating handleFlowError method * Using mocks instead of unnecessary spies
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor changes.
public void onComplete() { | ||
} | ||
}); | ||
Subscriber<ProcessRecordsInput> subscriber = mock(Subscriber.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just make this an instance variable and annotate it with Mock
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.