Package net.neoforged.testframework.impl
Class TestFrameworkImpl.TestsImpl
java.lang.Object
net.neoforged.testframework.impl.TestFrameworkImpl.TestsImpl
- All Implemented Interfaces:
MutableTestFramework.MutableTests
,TestFramework.Tests
- Enclosing class:
TestFrameworkImpl
@ParametersAreNonnullByDefault
public final class TestFrameworkImpl.TestsImpl
extends Object
implements MutableTestFramework.MutableTests
-
Field Summary
Modifier and TypeFieldDescriptionprivate final Collection
<Test> private Map
<net.neoforged.fml.common.EventBusSubscriber.Bus, net.neoforged.bus.api.IEventBus> private final Map
<String, EventListenerGroupImpl> private final Set
<TestListener> private final Map
<String, Test.Status> -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate Group
addGroupToParents
(Group group) void
addListener
(TestListener listener) Adds a global test listener.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.enabled()
Gets or creates a test group.void
boolean
Checks if a test is enabled.maybeGetGroup
(String id) void
Registers a test to the framework.void
setStatus
(String testId, Test.Status status)
-
Field Details
-
tests
-
groups
-
collectors
-
enabled
-
statuses
-
buses
-
globalListeners
-
allView
-
-
Constructor Details
-
TestsImpl
public TestsImpl()
-
-
Method Details
-
addListener
Description copied from interface:TestFramework.Tests
Adds a global test listener.- Specified by:
addListener
in interfaceTestFramework.Tests
- Parameters:
listener
- the listener
-
byId
Description copied from interface:TestFramework.Tests
Queries a test by its ID.- Specified by:
byId
in interfaceTestFramework.Tests
- Parameters:
id
- the ID of the test to query- Returns:
- the test, if present
-
getOrCreateGroup
Description copied from interface:TestFramework.Tests
Gets or creates a test group.- Specified by:
getOrCreateGroup
in interfaceTestFramework.Tests
- 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.
-
maybeGetGroup
- Specified by:
maybeGetGroup
in interfaceMutableTestFramework.MutableTests
-
allGroups
Description copied from interface:TestFramework.Tests
Returns all the registered test groups.- Specified by:
allGroups
in interfaceTestFramework.Tests
- Returns:
- all the registered test groups
-
enable
Description copied from interface:TestFramework.Tests
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.- Specified by:
enable
in interfaceTestFramework.Tests
- Parameters:
id
- the ID of the test to enable
-
disable
Description copied from interface:TestFramework.Tests
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.- Specified by:
disable
in interfaceTestFramework.Tests
- Parameters:
id
- the ID of the test to disable
-
isEnabled
Description copied from interface:TestFramework.Tests
Checks if a test is enabled.- Specified by:
isEnabled
in interfaceTestFramework.Tests
- Parameters:
id
- the ID of the test to check- Returns:
- if the test is enabled
-
getStatus
- Specified by:
getStatus
in interfaceTestFramework.Tests
-
setStatus
- Specified by:
setStatus
in interfaceMutableTestFramework.MutableTests
-
register
Description copied from interface:TestFramework.Tests
Registers a test to the framework.
It is recommended you register tests during mod loading, for proper indexing.- Specified by:
register
in interfaceTestFramework.Tests
- Parameters:
test
- the test to register
-
addGroupToParents
-
all
Description copied from interface:TestFramework.Tests
Returns an unmodifiable view of all the tests registered this this instance.- Specified by:
all
in interfaceTestFramework.Tests
- Returns:
- an unmodifiable view of all the tests registered this this instance
-
enabled
- Specified by:
enabled
in interfaceMutableTestFramework.MutableTests
-
initialiseDefaultEnabledTests
public void initialiseDefaultEnabledTests()- Specified by:
initialiseDefaultEnabledTests
in interfaceMutableTestFramework.MutableTests
-