mirror of
https://github.com/GTNewHorizons/ForgeMultipart.git
synced 2026-11-24 05:54:25 +00:00
test: characterize microblock event handler
Pin the client-only ABI and dedicated-server side stripping before the Java port.
This commit is contained in:
1 parent
2728c45a26
commit
cd84c140ae
2 files changed
+121
No files matched your search
+31
@@ -0,0 +1,31 @@
|
||||
package codechicken.multipart.test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import codechicken.microblock.handler.MicroblockEventHandler;
|
||||
import codechicken.microblock.handler.MicroblockEventHandler$;
|
||||
import cpw.mods.fml.common.eventhandler.EventBus;
|
||||
|
||||
class MicroblockEventHandlerFunctionalTest {
|
||||
|
||||
@Test
|
||||
void dedicatedServerRegistersTheCompanionAfterStrippingClientHandlers() throws Exception {
|
||||
assertEquals(0, MicroblockEventHandler.class.getDeclaredMethods().length);
|
||||
assertEquals(0, MicroblockEventHandler$.class.getDeclaredMethods().length);
|
||||
assertTrue(listenerOwners(MinecraftForge.EVENT_BUS).containsKey(MicroblockEventHandler$.MODULE$));
|
||||
}
|
||||
|
||||
private static Map<?, ?> listenerOwners(EventBus bus) throws Exception {
|
||||
Field ownersField = EventBus.class.getDeclaredField("listenerOwners");
|
||||
ownersField.setAccessible(true);
|
||||
return (Map<?, ?>) ownersField.get(bus);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user