Class MockSimulationExtension
java.lang.Object
org.palladiosimulator.simulizar.test.commons.extension.MockSimulationExtension
- All Implemented Interfaces:
org.junit.jupiter.api.extension.BeforeEachCallback
,org.junit.jupiter.api.extension.Extension
public class MockSimulationExtension
extends Object
implements org.junit.jupiter.api.extension.BeforeEachCallback
The MockSimulationExtension uses JUnit 5 Extension API to facilitate tests of SimuLizar internals
To enable use of this extension annotate your test class with
@ExtendWith(MockSimulation.class)
By annotating a test method with @MockSimulation
mocks of the required SimuLizar
internals are created which allow to test i. e. the behavior of model syncers.
In particular, the mocked infrastructure contains:
- Functioning ResourceRegistry, where factory methods
createXXX
return and register mock implementations - PCMModelManager providing the pcm instance as global pcm model
- SimuLizarRuntimeState, SimuComModel mocked to provide the above
Named
) or by
Identifier::getId() (Identified
).
Example:
@Test
@PCMInstanceFromSupplier(TestModelBase.Empty.class)
@MockSimulation
final void testAddResourceContainer(AbstractSimuLizarRuntimeState runtimeState, ResourceEnvironment environment,
@Named("Container 1") ResourceContainer container) {
}
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
beforeEach
(org.junit.jupiter.api.extension.ExtensionContext context)
-
Constructor Details
-
MockSimulationExtension
public MockSimulationExtension()
-
-
Method Details
-
beforeEach
- Specified by:
beforeEach
in interfaceorg.junit.jupiter.api.extension.BeforeEachCallback
- Throws:
Exception
-