Class EventTest
java.lang.Object
net.minecraftforge.eventtest.internal.EventTest
- Direct Known Subclasses:
EntityJoinedWorldTest
,LivingMakeBrainEventTest
The basis of the Event regression testing framework.
Allows each bootstrap event to be queried in turn to see whether the event passed.
For gameplay events, a callback is set for when the respective event is fired.
Test cases should be in a subclass of this, annotated with TestHolder.
If the test is for an event that fires in Bootstrap, set the field in constructor.
Register the event handler in the registerEvents method, which will be fired automatically.
Use the pass / fail / error methods in this class to tell the Framework what the result of the test is.
- Author:
- Curle
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Encodes information about how the test progressed. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Helper method - combines setting error state with detail message.protected void
Helper method - combines setting failure state with detail message.protected String
Provide extra detail about the error.A summarised view of the test result.boolean
protected void
pass()
Helper method - sets the test pass flag.abstract void
Register event handlers for this event.
-
Field Details
-
testResult
-
errorDetail
-
bootstrap
protected boolean bootstrap
-
-
Constructor Details
-
EventTest
public EventTest()
-
-
Method Details
-
getTestResult
A summarised view of the test result. For passes: "PASS" For failures: "FAIL - ($errorDetail)"- Returns:
- test result
-
getEnhancedDetail
Provide extra detail about the error. Pass-through of errorDetail is default, but some events require something more robust.- Returns:
- information to be shown in case of a test failure
-
isBootstrap
public boolean isBootstrap()- Returns:
- whether or not this event should be monitored while the game is loading to the main menu.
-
registerEvents
public abstract void registerEvents()Register event handlers for this event. Trade-off between "magic annotations" and verbosity should be evaluated. -
fail
Helper method - combines setting failure state with detail message.- Parameters:
reason
- extra detail about why the failure occurred
-
pass
protected void pass()Helper method - sets the test pass flag. -
error
Helper method - combines setting error state with detail message.- Parameters:
reason
- extra detail about why the error occured.
-