garbagemule / MobArena

MobArena plugin for Minecraft
GNU General Public License v3.0
189 stars 150 forks source link

Removed 1 unnecessary stubbing in MoneyThingPraserTest.java #780

Closed ARUS2023 closed 9 months ago

ARUS2023 commented 9 months ago

Summary

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 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.

Action