mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2025-08-06 12:50:16 +02:00
added alienboat
This commit is contained in:
@@ -7,16 +7,16 @@
|
||||
|
||||
package pp.battleship.model;
|
||||
|
||||
import pp.battleship.notification.GameEvent;
|
||||
import pp.battleship.notification.GameEventBroker;
|
||||
import pp.battleship.notification.ItemAddedEvent;
|
||||
import pp.battleship.notification.ItemRemovedEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import pp.battleship.notification.GameEvent;
|
||||
import pp.battleship.notification.GameEventBroker;
|
||||
import pp.battleship.notification.ItemAddedEvent;
|
||||
import pp.battleship.notification.ItemRemovedEvent;
|
||||
|
||||
/**
|
||||
* Represents a rectangular map that holds ships and registers shots fired.
|
||||
* It also supports event notification for game state changes such as item addition or removal.
|
||||
@@ -66,7 +66,7 @@ public class ShipMap {
|
||||
*/
|
||||
private void addItem(Item item) {
|
||||
items.add(item);
|
||||
notifyListeners(new ItemRemovedEvent(item, this));
|
||||
notifyListeners(new ItemAddedEvent(item, this));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -98,7 +98,7 @@ public class ShipMap {
|
||||
*/
|
||||
public void remove(Item item) {
|
||||
items.remove(item);
|
||||
notifyListeners(new ItemAddedEvent(item, this));
|
||||
notifyListeners(new ItemRemovedEvent(item, this));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -54,6 +54,8 @@ public class ShipMapTest {
|
||||
verify(mockBroker).notifyListeners(any(ItemAddedEvent.class));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testRemoveItem() {
|
||||
map.add(battleship);
|
||||
|
Reference in New Issue
Block a user