feat(model): World.combinations field + backward-compatible constructors
This commit is contained in:
@@ -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");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user