fix: deleted duplicate equals

This commit is contained in:
Yannik Bretschneider 2021-05-02 00:05:55 +02:00
parent 82fa54bd2d
commit abd70a0d05
2 changed files with 77 additions and 11 deletions

View File

@ -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}

View File

@ -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() {
}
}