Class ScenarioTestHelper
java.lang.Object
fr.fidorial.testing.ScenarioTestHelper
The toolbox handed to a
ScenarioTest method: its world,
mock players, assertions and sequences.- Since:
- 0.1.0
-
Method Summary
Modifier and TypeMethodDescriptionvoidassertBlockAt(BlockPos pos, Key expected) Fails the test unless a block of the expected type sits at a position.voidassertTrue(boolean condition, String messageIfFalse) Fails the test unless a condition holds.voidFails the test right away.sequence()Starts building the sequence of steps of this test; the test passes once the built sequence completes.summonPlayer(String name, Location location, GameMode gameMode) Summons a mock player intoworld().summonPlayer(String name, World world, Location location, GameMode gameMode) Summons a mock player into the specified world.world()Returns the world the test runs in.
-
Method Details
-
world
Returns the world the test runs in.- Returns:
- the world the test runs in
- Since:
- 0.1.0
-
summonPlayer
Summons a mock player intoworld().- Parameters:
name- the player namelocation- where to spawn the playergameMode- the game mode of the player- Returns:
- the summoned player
- Since:
- 0.1.0
- API Note:
- the player is automatically despawned upon test completion, regardless of its result.
-
summonPlayer
Summons a mock player into the specified world.- Parameters:
name- the player nameworld- the world to spawn the player inlocation- where to spawn the playergameMode- the game mode of the player- Returns:
- the summoned player
- Since:
- 0.1.0
- API Note:
- the player is automatically despawned upon test completion, regardless of its result.
-
fail
Fails the test right away.- Parameters:
reason- the failure message- Throws:
RuntimeException- always, to abort the test- Since:
- 0.1.0
-
assertTrue
Fails the test unless a condition holds.- Parameters:
condition- the condition to checkmessageIfFalse- the failure message- Since:
- 0.1.0
-
assertBlockAt
-
sequence
Starts building the sequence of steps of this test; the test passes once the built sequence completes.- Returns:
- a sequence builder; call
build()on it before the method returns - Since:
- 0.1.0
-