Package net.neoforged.testframework
Interface TestFramework.Tests
- All Known Subinterfaces:
MutableTestFramework.MutableTests
- All Known Implementing Classes:
TestFrameworkImpl.TestsImpl
- Enclosing interface:
TestFramework
@ParametersAreNonnullByDefault
public static interface TestFramework.Tests
Interface used for accessing a framework's tests.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(TestListener listener) Adds a global test listener.@UnmodifiableView Collection
<Test> all()
Returns an unmodifiable view of all the tests registered this this instance.Returns all the registered test groups.Queries a test by its ID.void
Disables a test.void
Enables a test.Gets or creates a test group.boolean
Checks if a test is enabled.void
Registers a test to the framework.
-
Method Details
-
byId
Queries a test by its ID.- Parameters:
id
- the ID of the test to query- Returns:
- the test, if present
-
getOrCreateGroup
Gets or creates a test group.- Parameters:
id
- the ID of the group- Returns:
- the old group, if one existed, or the new one if a group with that ID did not exist before.
-
allGroups
Collection<Group> allGroups()Returns all the registered test groups.- Returns:
- all the registered test groups
-
enable
Enables a test.
This method only updates the local test.
It will not update clients or the server.
Prefer usingTestFramework.setEnabled(Test, boolean, Entity)
instead.- Parameters:
id
- the ID of the test to enable
-
disable
Disables a test.
This method only updates the local test.
It will not update clients or the server.
Prefer usingTestFramework.setEnabled(Test, boolean, Entity)
instead.- Parameters:
id
- the ID of the test to disable
-
isEnabled
Checks if a test is enabled.- Parameters:
id
- the ID of the test to check- Returns:
- if the test is enabled
-
getStatus
-
register
Registers a test to the framework.
It is recommended you register tests during mod loading, for proper indexing.- Parameters:
test
- the test to register
-
all
@UnmodifiableView Collection<Test> all()Returns an unmodifiable view of all the tests registered this this instance.- Returns:
- an unmodifiable view of all the tests registered this this instance
-
addListener
Adds a global test listener.- Parameters:
listener
- the listener
-