feat: Ending model + endings.yaml loading (ordered, optional)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-31 22:47:38 +02:00
parent 3ac9540a6a
commit f9bd2d9a67
6 changed files with 82 additions and 3 deletions

View File

@@ -0,0 +1,22 @@
package thb.jeanluc.adventure.loader;
import org.junit.jupiter.api.Test;
import thb.jeanluc.adventure.loader.dto.ConditionDto;
import thb.jeanluc.adventure.loader.dto.EndingDto;
import thb.jeanluc.adventure.model.Ending;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
class EndingLoadingTest {
@Test
void factoryMapsFields() {
Ending e = EndingFactory.fromDto(new EndingDto("victory", "Won", true,
List.of(new ConditionDto("manor_secured", null, null)), "You win."));
assertThat(e.id()).isEqualTo("victory");
assertThat(e.victory()).isTrue();
assertThat(e.when()).hasSize(1);
assertThat(e.text()).isEqualTo("You win.");
}
}