}
}
});
// Create 2 walls
Wall wall1 = new Wall(0, 0, 100, 0, 0);
Wall wall2 = new Wall(100, 0, 100, 100, 0);
// Add them to home
home.addWall(wall1);
home.addWall(wall2);
// Check they were added and that wall listener received a notification for each wall
assertWallCollectionContains(home.getWalls(), wall1, wall2);
assertWallCollectionContains(addedWalls, wall1, wall2);
// Join end point of first wall to start point of second wall
wall1.setWallAtEnd(wall2);
// Check wall1 end wall is wall2 and that wall listener received 1 notification
assertSame("Wall not joined", wall2, wall1.getWallAtEnd());
assertWallCollectionContains(updatedWalls, wall1);
// Join start point of second wall to end point of first wall
updatedWalls.clear();
wall2.setWallAtStart(wall1);
// Check wall2 start wall is wall1 and that wall listener received 1 notification
assertSame("Wall not joined", wall1, wall2.getWallAtStart());
assertWallCollectionContains(updatedWalls, wall2);
// Move end point of second wall
updatedWalls.clear();
wall2.setXEnd(60);
wall2.setYEnd(100);
// Check wall2 end position and that wall listener received 1 notifications
assertEquals("Incorrect abscissa", 60f, wall2.getXEnd());
assertEquals("Incorrect ordinate", 100f, wall2.getYEnd());
assertWallCollectionContains(updatedWalls, wall2);
// Move point shared by the two walls
updatedWalls.clear();
wall2.setXStart(60);
wall2.setYStart(0);
// Check wall2 start point position
assertEquals("Incorrect abscissa", 60f, wall2.getXStart());
assertEquals("Incorrect ordinate", 0f, wall2.getYStart());
// Check that wall listener received 2 notifications
assertWallCollectionContains(updatedWalls, wall2);
updatedWalls.clear();
wall1.setXEnd(60);
wall1.setYEnd(0);
// Check wall1 end point position
assertEquals("Incorrect abscissa", 60f, wall1.getXEnd());
assertEquals("Incorrect ordinate", 0f, wall1.getYEnd());
// Check that wall listener received 2 notifications
assertWallCollectionContains(updatedWalls, wall1);
// Detach second wall from first wall
updatedWalls.clear();
wall2.setWallAtStart(null);
// Check wall2 and wall1 are not joined and that wall listener received 2 notifications
assertSame("Wall joined", null, wall1.getWallAtEnd());
assertSame("Wall joined", null, wall2.getWallAtStart());
assertWallCollectionContains(updatedWalls, wall1, wall2);
// Delete second wall
home.deleteWall(wall2);
// Check it was removed and that wall listener received a notification