BukkitConfig calls mcMMO.p.getDataFolder() in its constructor to
determine where to write config files. When tests mock mcMMO.p but
don't stub getDataFolder(), it returns null, which Java resolves to
the current working directory (the project root), causing files like
experience.yml to be created there.
Fix by stubbing mcMMO.p.getDataFolder() with a fresh temporary
directory in every test setup that mocks mcMMO.p:
- MMOTestEnvironment.mockBaseEnvironment(): creates testDataFolder
in temp and deletes it in cleanUpStaticMocks()
- SQLDatabaseManagerTest.setUpAll(): same pattern, cleaned in tearDownAll()
- FlatFileDatabaseManagerTest.initBeforeAll(): same pattern, cleaned
in the new tearDownAll() method
Also remove the .gitignore band-aid entries that were added to paper
over the symptom.
- FishingTreasureConfig.fixMooshroomEntityId was a public static method that
called mcMMO.p.getLogger() directly, causing NPE when tests invoked it without
a live plugin instance. Add a private static Logger field and use it in the
static method instead.
- TridentsTest.impaleDamageBonusShouldMatchRankOneBaseDamage had a stale expected
value (1.0) left over from before commit 71868d9d fixed the Impale formula to
use rank * multiplier. The correct expectation for rank 1 is
base + 1 * multiplier = 1.5. Rename the test to match the new semantic.
- Add @Tag(docker) to FlatFileDatabaseManagerTest so the existing
skip-docker-tests Maven profile (-DskipDockerTests=true) excludes it alongside
SQLDatabaseManagerTest.
- Add generated config file names (experience.yml, config.yml, etc.) to
.gitignore to prevent accidental staging when tests run without a properly
mocked getDataFolder().