In our analysis of the project, we observed that
1) 1 stubbing which stubbed queryMap("layer") is created in PhotonRequestFactoryTest.createRequestWithQueryParams method but never executed in 3 tests:
PhotonRequestFactoryTest.testWithLayerFilters, PhotonRequestFactoryTest.testWithDuplicatedLayerFilters,
PhotonRequestFactoryTest.testWithBadLayerFilters.
2) 3 stubbings which stubbed queryParams() method, queryMap("osm_tag"), and queryMap("layer") are created in PhotonRequestFactoryTest.createRequestWithQueryParams method but never executed in 1 test:
PhotonRequestFactoryTest.testBadTagFilters.
3) 2 stubbings which stubbed queryParams() method,queryMap("osm_tag") is created in PhotonRequestFactoryTest.createRequestWithQueryParams method but never executed in 1 test:
PhotonRequestFactoryTest.testTagFilters.
In our analysis of the project, we observed that 1) 1 stubbing which stubbed
queryMap("layer")
is created inPhotonRequestFactoryTest.createRequestWithQueryParams
method but never executed in 3 tests:PhotonRequestFactoryTest.testWithLayerFilters
,PhotonRequestFactoryTest.testWithDuplicatedLayerFilters
,PhotonRequestFactoryTest.testWithBadLayerFilters
.2) 3 stubbings which stubbed
queryParams()
method,queryMap("osm_tag")
, andqueryMap("layer")
are created inPhotonRequestFactoryTest.createRequestWithQueryParams
method but never executed in 1 test:PhotonRequestFactoryTest.testBadTagFilters
.3) 2 stubbings which stubbed
queryParams()
method,queryMap("osm_tag")
is created inPhotonRequestFactoryTest.createRequestWithQueryParams
method but never executed in 1 test:PhotonRequestFactoryTest.testTagFilters
.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.