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(BlockPosition position, TypedKey<BlockType> expected) Fails the test unless a block of the expected type sits at a position.voidassertFalse(boolean condition, String messageIfTrue) Fails the test unless a condition does not hold.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
-
assertFalse
-
assertBlockAt
Fails the test unless a block of the expected type sits at a position.- Parameters:
position- the block positionexpected- the expected block key;minecraft:airmatches any kind of air- Since:
- 0.1.0
-
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
-