In our analysis of the project, we observed that
1) 2 unnecessary stubbings which stubbed getAvailableLogTypes method, get method in beforeTest are created but are never executed by 5 tests LogStorageTest.collectLogsTest, LogStorageTest.cleanLogsTest, LogStorageTest.collectAvailableTypesOnlyOnceTest, LogStorageTest.skipCollectionIfNull, LogStorageTest.disabledOnError. [See SecondLogStorageTest.java]
2) 1 unnecessary stubbing which stubbed get method in beforeTest is created but is never executed by 4 tests LogStorageTest.collectLogsTest, LogStorageTest.cleanLogsTest, LogStorageTest.collectAvailableTypesOnlyOnceTest, LogStorageTest.queryLogsRemoveTest. [SeeThirdLogStorageTest.java]
In our analysis of the project, we observed that 1) 2 unnecessary stubbings which stubbed
getAvailableLogTypes
method,get
method inbeforeTest
are created but are never executed by 5 testsLogStorageTest.collectLogsTest
,LogStorageTest.cleanLogsTest
,LogStorageTest.collectAvailableTypesOnlyOnceTest
,LogStorageTest.skipCollectionIfNull
,LogStorageTest.disabledOnError
. [SeeSecondLogStorageTest.java
]2) 1 unnecessary stubbing which stubbed
get
method inbeforeTest
is created but is never executed by 4 testsLogStorageTest.collectLogsTest
,LogStorageTest.cleanLogsTest
,LogStorageTest.collectAvailableTypesOnlyOnceTest
,LogStorageTest.queryLogsRemoveTest
. [SeeThirdLogStorageTest.java
]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.