feat(model): World.combinations field + backward-compatible constructors

This commit is contained in:
2026-06-01 17:13:05 +02:00
parent bbc4fc37f8
commit 9f9b0c0808
2 changed files with 42 additions and 4 deletions

View File

@@ -0,0 +1,29 @@
package thb.jeanluc.adventure.model;
import org.junit.jupiter.api.Test;
import java.util.List;
import java.util.Map;
import static org.assertj.core.api.Assertions.assertThat;
class WorldCombinationsTest {
@Test
void legacyConstructorsDefaultToEmptyCombinations() {
World w5 = new World(Map.of(), Map.of(), Map.of(), "t", "w");
World w6 = new World(Map.of(), Map.of(), Map.of(), "t", "w", Map.of());
World w7 = new World(Map.of(), Map.of(), Map.of(), "t", "w", Map.of(), List.of());
assertThat(w5.getCombinations()).isEmpty();
assertThat(w6.getCombinations()).isEmpty();
assertThat(w7.getCombinations()).isEmpty();
}
@Test
void fullConstructorStoresCombinations() {
Combination c = new Combination("a", "b", List.of(), List.of(), null, List.of(), "r", null);
World w = new World(Map.of(), Map.of(), Map.of(), "t", "w",
Map.of(), List.of(), Map.of(c.key(), c));
assertThat(w.getCombinations()).containsKey("a|b");
}
}