diff --git a/.idea/misc.xml b/.idea/misc.xml index 9d2ecf0..fa5b436 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,5 +1,6 @@ + - + \ No newline at end of file diff --git a/src/ch/epfl/chacun/ZonePartitions.java b/src/ch/epfl/chacun/ZonePartitions.java index e058c31..ab2e9b7 100644 --- a/src/ch/epfl/chacun/ZonePartitions.java +++ b/src/ch/epfl/chacun/ZonePartitions.java @@ -21,13 +21,13 @@ public record ZonePartitions(ZonePartition forests, ZonePartition forests; + private final ZonePartition.Builder forests; // The builder of the meadows partition - private ZonePartition.Builder meadows; + private final ZonePartition.Builder meadows; // The builder of the rivers partition - private ZonePartition.Builder rivers; + private final ZonePartition.Builder rivers; // The builder of the river systems partition - private ZonePartition.Builder riverSystems; + private final ZonePartition.Builder riverSystems; /** * Returns a new builder whose four partitions are initially identical to those of the given @@ -82,7 +82,7 @@ public void addTile(Tile tile) { } /** - * Connects each other the two given tile sides by connecting the corresponding areas. + * Connects to each other the two given tile sides by connecting the corresponding areas. * * @param s1 the first tile side * @param s2 the second tile side diff --git a/test/ch/epfl/chacun/ZonePartitionsTest.java b/test/ch/epfl/chacun/ZonePartitionsTest.java index bfd897b..7cdbfab 100644 --- a/test/ch/epfl/chacun/ZonePartitionsTest.java +++ b/test/ch/epfl/chacun/ZonePartitionsTest.java @@ -50,5 +50,26 @@ void addTileWorks() { testBuilder.addTile(tile); assertEquals(expectedZonePartitions, testBuilder.build()); + + } + + @Test + void connectSidesWorks() { + // Meadows + Zone.Meadow meadow1 = new Zone.Meadow(0, new ArrayList<>(List.of(new Animal(0 + , Animal.Kind.AUROCHS))), null); + Zone.Meadow meadow2 = new Zone.Meadow(1, new ArrayList<>(), null); + + TileSide.Meadow meadowSide1 = new TileSide.Meadow(meadow1); + TileSide.Meadow meadowSide2 = new TileSide.Meadow(meadow2); + + Set meadows1 = Set.of(meadow1); + Set meadows2 = Set.of(meadow2); + + Area meadowArea1 = new Area<>(meadows1, new ArrayList<>(), 1); + Area meadowArea2 = new Area<>(meadows2, new ArrayList<>(), 1); + + ZonePartition meadowZonePartition = new ZonePartition<>(Set.of(meadowArea1, meadowArea2)); } + }