feat(tutorial): Tutorial model + TutorialLoader + tutorial.yaml content

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-01 21:25:48 +02:00
parent 5c9a8cb568
commit 95098fbb09
8 changed files with 198 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
package thb.jeanluc.adventure.loader;
import org.junit.jupiter.api.Test;
import thb.jeanluc.adventure.model.Tutorial;
import static org.assertj.core.api.Assertions.assertThat;
class TutorialLoaderTest {
@Test
void loadsTheTestFixture() {
Tutorial t = new TutorialLoader().load(); // test-classpath /world/tutorial.yaml shadows prod
assertThat(t.isEmpty()).isFalse();
assertThat(t.intro()).isNotBlank();
assertThat(t.closingTips()).isNotBlank();
assertThat(t.steps()).hasSize(2);
assertThat(t.steps().getFirst().expect()).isEqualTo("look");
assertThat(t.steps().getFirst().minArgs()).isZero();
}
@Test
void missingFileReturnsEmptyTutorial() {
Tutorial t = new TutorialLoader("/no-such-base").load();
assertThat(t.isEmpty()).isTrue();
assertThat(t.steps()).isEmpty();
}
}

View File

@@ -0,0 +1,14 @@
intro: |
Test intro.
steps:
- instruction: "Look: type 'look'."
expect: look
confirm: "Looked."
hint: "Type look."
- instruction: "Take: type 'take <item>'."
expect: take
minArgs: 1
confirm: "Took it."
hint: "Take something."
closingTips: |
Test tips.