From abd70a0d0589fa89494a4c456625a02b3371e76e Mon Sep 17 00:00:00 2001 From: Yannik Bretschneider Date: Sun, 2 May 2021 00:05:55 +0200 Subject: [PATCH] fix: deleted duplicate equals --- .../gamelibrary/entities/EntityID.java | 11 --- .../gamelibrary/events/EventBuilderTest.java | 77 +++++++++++++++++++ 2 files changed, 77 insertions(+), 11 deletions(-) create mode 100644 src/test/java/uulm/teamname/marvelous/gamelibrary/events/EventBuilderTest.java diff --git a/src/main/java/uulm/teamname/marvelous/gamelibrary/entities/EntityID.java b/src/main/java/uulm/teamname/marvelous/gamelibrary/entities/EntityID.java index e1b38ca..a855563 100644 --- a/src/main/java/uulm/teamname/marvelous/gamelibrary/entities/EntityID.java +++ b/src/main/java/uulm/teamname/marvelous/gamelibrary/entities/EntityID.java @@ -29,17 +29,6 @@ public class EntityID { return type == other; } - @Override - public boolean equals(Object obj){ - if(this == obj) return true; - - if(!(obj instanceof EntityID)) return false; - - EntityID other = (EntityID)obj; - - return this.id == other.id && this.type == other.type; - } - /** * Clones this entity id. * @return The cloned {@link EntityID} diff --git a/src/test/java/uulm/teamname/marvelous/gamelibrary/events/EventBuilderTest.java b/src/test/java/uulm/teamname/marvelous/gamelibrary/events/EventBuilderTest.java new file mode 100644 index 0000000..f138822 --- /dev/null +++ b/src/test/java/uulm/teamname/marvelous/gamelibrary/events/EventBuilderTest.java @@ -0,0 +1,77 @@ +package uulm.teamname.marvelous.gamelibrary.events; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import static org.assertj.core.api.Assertions.*; +import uulm.teamname.marvelous.gamelibrary.IntVector2; +import uulm.teamname.marvelous.gamelibrary.entities.*; + +import java.util.HashMap; + +import static org.mockito.Mockito.*; +import static org.junit.jupiter.api.Assertions.*; + +class EventBuilderTest { + + @BeforeEach + void setUp() { + EventBuilder builder = new EventBuilder() + .withType(EventType.CustomEvent) + .withTargetEntity(new EntityID(EntityType.P1, 1)) + .withTargetField(new IntVector2(11, 13)) + .withAmount(15) + .withOriginEntity(new EntityID(EntityType.P2, 4)) + .withOriginField(new IntVector2(15, 3)) + .withStoneType(StoneType.MindStone) + .withRoundCount(3) + .withTurnCount(4) + .withCharacterOrder(new EntityID[] { + new EntityID(EntityType.P1, 4), + new EntityID(EntityType.P1, 1), + new EntityID(EntityType.P2, 2), + new EntityID(EntityType.P2, 4), + new EntityID(EntityType.P1, 3), + new EntityID(EntityType.P2, 5),}) + .withNextCharacter(new EntityID(EntityType.P2, 2)) + .withPlayerWon(2) + .withMessage("Some message") + .withTimeLeft(11) + .withEntities(new Entity[] {}) + .withTurnOrder(new EntityID[] { + new EntityID(EntityType.P1, 4), + new EntityID(EntityType.P1, 1), + new EntityID(EntityType.P2, 2), + new EntityID(EntityType.P2, 4), + new EntityID(EntityType.P1, 3), + new EntityID(EntityType.P2, 5),}) + .withActiveCharacter(new EntityID(EntityType.P1, 1)) + .withWinCondition(false) + .withTeamIdentifier("Team25") + .withCustomContent(new HashMap<>()); + } + + @Test + void buildGameEvent() { + var gameEvent = new EventBuilder() + .withType(EventType.DisconnectEvent) + .buildEntityEvent(); + + assertThat(gameEvent).isEqualTo() + } + + @Test + void buildEntityEvent() { + } + + @Test + void buildCharacterEvent() { + } + + @Test + void buildGamestateEvent() { + } + + @Test + void buildCustomEvent() { + } +} \ No newline at end of file