I have a modular Maven project and I'm creating tests for one of modules, using files of another module, but for some reason MockBukkit can't find plugin.yml, although debug says it exists.
Reproducible Test
@FieldDefaults(level = AccessLevel.PRIVATE)
public class TestPlugin {
static Plugin plugin;
@BeforeAll
@SneakyThrows
public static void setUp() {
var server = MockBukkit.mock();
System.out.println(LibraryBukkitPlugin.class.getClassLoader().getResource("plugin.yml"));
System.out.println(LibraryBukkitPlugin.class.getClassLoader().getResources("plugin.yml").hasMoreElements());
System.out.println(LibraryBukkitPlugin.class.getClassLoader().getResources("plugin.yml").nextElement());
plugin = MockBukkit.load(LibraryBukkitPlugin.class);
}
@AfterAll
public static void tearDown() {
MockBukkit.unmock();
}
}
Anything else?
Test response:
file:/D:/Development/Projects/IdeaProjects/Library/bukkit/target/classes/plugin.yml
true
file:/D:/Development/Projects/IdeaProjects/Library/bukkit/target/classes/plugin.yml
Test ignored.
java.lang.RuntimeException: java.io.FileNotFoundException: Could not find file plugin.yml. Maybe forgot to add the 'main' property?
at be.seeseemelk.mockbukkit.plugin.PluginManagerMock.loadPlugin(PluginManagerMock.java:422)
at be.seeseemelk.mockbukkit.MockBukkit.load(MockBukkit.java:179)
at be.seeseemelk.mockbukkit.MockBukkit.load(MockBukkit.java:165)
at TestPlugin.setUp(TestPlugin.java:31)
Is there an existing issue for this?
Are you using the latest version of MockBukkit?
Minecraft Version
1.19
Describe the bug
I have a modular Maven project and I'm creating tests for one of modules, using files of another module, but for some reason MockBukkit can't find
plugin.yml
, although debug says it exists.Reproducible Test
Anything else?
Test response:
File by link:
Plugin class: