Describe this change in 1-2 sentences:
Duplicated the content ofMoneyThingParserTest.java to SecondMoneyThingParserTest.java and removed the unnecessary stubbing when(plugin.getEconomy()).thenReturn(economy) in the setUp method, move the tests that do not execute the stubbing from MoneyThingParserTest to SecondMoneyThingParserTest
Because the unnecessary stubbing when(plugin.getEconomy()).thenReturn(economy) exists in the setUp method, which will be executed before each test, we cannot duplicate the setUp method. To safely remove the unnecessary stubbing, we duplicated the test class, removed the unnecessary stubbing from the setUp method, and moved the two tests noPrefixNoBenjamins and nullEconomyNullMoney from the MoneyThingParserTest class to SecondMoneyThingParserTest class.
Summary
MoneyThingParserTest.java
toSecondMoneyThingParserTest.java
and removed the unnecessary stubbingwhen(plugin.getEconomy()).thenReturn(economy)
in the setUp method, move the tests that do not execute the stubbing fromMoneyThingParserTest
toSecondMoneyThingParserTest
Problem
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).
Solution
Because the unnecessary stubbing
when(plugin.getEconomy()).thenReturn(economy)
exists in thesetUp
method, which will be executed before each test, we cannot duplicate thesetUp
method. To safely remove the unnecessary stubbing, we duplicated the test class, removed the unnecessary stubbing from thesetUp
method, and moved the two testsnoPrefixNoBenjamins
andnullEconomyNullMoney
from theMoneyThingParserTest
class toSecondMoneyThingParserTest
class.Action