Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Removed 2 unnecessary stubbings in CodePipelineJobPollerTest.java #13

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

Conversation

ARUS2023
Copy link

@ARUS2023 ARUS2023 commented Oct 6, 2023

Issue #, if available:

Description of changes:
In our analysis of the project, we observed that

  1. 1 stubbing which stubbed acknowledgeJob method is created but never executed by 8 tests CodePipelineJobPollerTest.testClassLoad, CodePipelineJobPollerTest.shouldThrowWhenJobServiceIsNull, CodePipelineJobPollerTest.shouldThrowWhenJobProcessorIsNull, CodePipelineJobPollerTest.shouldThrowWhenExecutorServiceIsNull, CodePipelineJobPollerTest.shouldPollForJobsWhenThereAreNoActiveWorkerThreads, CodePipelineJobPollerTest.shouldPollForJobsWithBatchSizeWhenNotAllWorkerThreadsAreBusy, CodePipelineJobPollerTest.shouldStartThreadsForAllReturnedJobs, CodePipelineJobPollerTest.shouldNotHandOutWorkToJobProcessorWhenStatusFailed.

  2. 1 stubbing which stubbed process method is created but never executed by 10 tests CodePipelineJobPollerTest.testClassLoad, CodePipelineJobPollerTest.shouldThrowWhenJobServiceIsNull, CodePipelineJobPollerTest.shouldThrowWhenJobProcessorIsNull, CodePipelineJobPollerTest.shouldThrowWhenExecutorServiceIsNull, CodePipelineJobPollerTest.shouldPollForJobsWhenThereAreNoActiveWorkerThreads, CodePipelineJobPollerTest.shouldPollForJobsWithBatchSizeWhenNotAllWorkerThreadsAreBusy, CodePipelineJobPollerTest.shouldStartThreadsForAllReturnedJobs, CodePipelineJobPollerTest.shouldNotHandOutWorkToJobProcessorWhenStatusFailed, CodePipelineJobPollerTest.shouldHandleAllRuntimeExceptions, CodePipelineJobPollerTest.shouldReportFailureWhenProcessorReturnsFailure.

Unnecessary stubbings are stubbed method calls that were never realized during test execution. Mockito recommends to remove unnecessary stubbings (https://www.javadoc.io/doc/org.mockito/mockito-core/latest/org/mockito/exceptions/misusing/UnnecessaryStubbingException.html).

We propose below a solution to remove the unnecessary stubbings.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant