diff --git a/.idea/vcs.xml b/.idea/vcs.xml
index 35eb1dd..b659007 100644
--- a/.idea/vcs.xml
+++ b/.idea/vcs.xml
@@ -2,5 +2,6 @@
+
\ No newline at end of file
diff --git a/src/test/java/uulm/teamname/marvelous/gamelibrary/events/EventBuilderTest.java b/src/test/java/uulm/teamname/marvelous/gamelibrary/events/EventBuilderTest.java
index 6f71c03..da04003 100644
--- a/src/test/java/uulm/teamname/marvelous/gamelibrary/events/EventBuilderTest.java
+++ b/src/test/java/uulm/teamname/marvelous/gamelibrary/events/EventBuilderTest.java
@@ -218,15 +218,78 @@ class EventBuilderTest {
}
// TODO: implement tests for unchecked CharacterEvents and EntityEvents
+ @Test
+ void buildWrongEntityEvent1() {
+ EventBuilder eb = new EventBuilder(EventType.DestroyedEntityEvent);
+ //the target entity is not set
+ EntityEvent des2 = eb
+ .withTargetField(new IntVector2(1,1))
+ .buildEntityEvent();
+ //the target entity is not set --> check() return false
+ boolean b = des2.check();
+ assertEquals(b, false);
+
+ }
@Test
void buildEntityEvent() {
- // TODO: check all entityEvent type validations for correctness
+ //testing EntityEvent class
+ assertThat(new EventBuilder(EventType.DestroyedEntityEvent)
+ .withTargetField(new IntVector2(1,1))
+ .withTargetEntity(new EntityID(EntityType.P1,1))
+ .buildEntityEvent().check()).isTrue();
+
+ EntityEvent des = new EntityEvent();
+ des.type = EventType.DestroyedEntityEvent;
+ des.targetEntity= new EntityID(EntityType.P1,1);
+ des.targetField= new IntVector2(1,1);
+
+ EventBuilder eb = new EventBuilder(EventType.DestroyedEntityEvent);
+ EntityEvent des2 = eb
+ .withTargetField(new IntVector2(1,1))
+ .withTargetEntity(new EntityID(EntityType.P1,1))
+ .buildEntityEvent();
+
+ //testing EventBuilder
+ assertEquals(des.type, des2.type);
+ assertEquals(des.targetEntity, des2.targetEntity);
+ assertEquals(des.targetField, des2.targetField);
+ // EntityEvent des2 = new EntityEvent(eb.);
+
+
}
@Test
void buildCharacterEvent() {
- // TODO: check all characterEvent type validations for correctness
+ //testing CharacterEvent class
+ assertThat(new EventBuilder(EventType.MeleeAttackEvent)
+ .withOriginField(new IntVector2(2,2))
+ .withTargetField(new IntVector2(1,1))
+ .withOriginEntity(new EntityID(EntityType.P2,2))
+ .withTargetEntity(new EntityID(EntityType.P1,1))
+ .buildEntityEvent().check()).isTrue();
+
+ CharacterEvent des = new CharacterEvent();
+ des.type = EventType.MeleeAttackEvent;
+ des.originField= new IntVector2(2,2);
+ des.targetEntity= new EntityID(EntityType.P1,1);
+ des.originEntity = new EntityID(EntityType.P2,2);
+ des.targetField= new IntVector2(1,1);
+
+ EventBuilder eb = new EventBuilder(EventType.MeleeAttackEvent);
+ CharacterEvent des2 = eb
+ .withOriginField(new IntVector2(2,2))
+ .withTargetField(new IntVector2(1,1))
+ .withOriginEntity(new EntityID(EntityType.P2,2))
+ .withTargetEntity(new EntityID(EntityType.P1,1))
+ .buildCharacterEvent();
+ //testing EventBuilder
+ assertEquals(des.type, des2.type);
+ assertEquals(des.targetEntity, des2.targetEntity);
+ assertEquals(des.targetField, des2.targetField);
+ assertEquals(des.originEntity, des2.originEntity);
+ assertEquals(des.originField, des2.originField);
+
}
@Test
@@ -269,6 +332,24 @@ class EventBuilderTest {
@Test
void buildCustomEvent() {
- // TODO: check CustomEvent validation for correctness
+ //testing CustomEvent class
+ assertThat(new EventBuilder(EventType.CustomEvent)
+ .withCustomContent(new HashMap())
+ .buildCustomEvent().check()).isTrue();
+
+ CustomEvent des = new CustomEvent();
+ des.type = EventType.CustomEvent;
+ des.customContent= new HashMap();
+
+
+ EventBuilder eb = new EventBuilder(EventType.CustomEvent);
+ CustomEvent des2 = eb
+ .withCustomContent(new HashMap())
+ .buildCustomEvent();
+
+ //testing EventBuilder
+ assertEquals(des.type, des2.type);
+ assertEquals(des.customContent, des2.customContent);
+
}
}