PluginTestAdapter provides direct PluginManager access, while PluginAssert wraps lookups as failing assertions with descriptive messages.
Plugin loading tests are smoke tests for your server setup. If a plugin fails to load (missing dependency, initialization error, wrong JAR placement), these tests catch it immediately. This is especially valuable in CI/CD pipelines where you want to verify the complete plugin set is loaded before running feature tests.
Complete Example Suite
Adapter Methods
| Method | Returns | Description |
|---|---|---|
isPluginLoaded(String name) | boolean | Check if a plugin with the given name is loaded |
getPluginNames() | List<String> | List the names of all loaded plugins |
getPlugin(String name) | Object | Get the plugin instance by name (returns null if not found) |
Assertion Methods
| Method | Failure Message |
|---|---|
assertPluginLoaded(String pluginName) | ”Expected plugin ‘[pluginName]’ to be loaded but it was not found” |
assertPluginCount(int expected) | ”Expected [expected] loaded plugins but found [actual]“ |
When to Test Plugins
Plugin tests serve as the foundation of your test suite:- CI/CD smoke tests - Verify all required plugins loaded before running feature tests
- Dependency checks - Confirm your mod’s plugin dependencies are present
- Version validation - After server updates, verify the plugin set is intact
- Debugging - Use
getPluginNames()to see exactly what loaded when tests fail
assertPluginLoaded() searches the PluginManager by name using reflection - it checks getPlugin(), isLoaded(), and getPlugins() accessors.
Next Steps
- Persistence - verify save infrastructure
- Crafting - verify recipe registrations
- Commands - test plugin commands