Attach the visualcharacter components to the other character entities in test
@@ -113,6 +113,8 @@ public void testSendingOfCreateVisualCharacterEvent() {
EntityRef otherCharacterEntity = mockEntityWithUniqueId();
List<Event> otherCharacterEntityEvents = new ArrayList<>();
recordEntityEventsToList(otherCharacterEntity, otherCharacterEntityEvents);
+ VisualCharacterComponent visualComponentOfOtherCharacter = new VisualCharacterComponent();
+ Mockito.when(otherCharacterEntity.getComponent(VisualCharacterComponent.class)).thenReturn(visualComponentOfOtherCharacter);
clientEntityReturnedByLocalPlayer = EntityRef.NULL;
@@ -122,7 +124,7 @@ public void testSendingOfCreateVisualCharacterEvent() {
* since the character is not properly linked yet nothing should happen
*/
system.onActivatedVisualCharacter(OnActivatedComponent.newInstance(), otherCharacterEntity,
- new VisualCharacterComponent());
+ visualComponentOfOtherCharacter);
system.onActivatedVisualCharacter(OnActivatedComponent.newInstance(), ownCharacterEntity,
visualComponentOfOwnCharacter);
@@ -140,12 +142,14 @@ public void testSendingOfCreateVisualCharacterEvent() {
EntityRef laterJoiningCharacterEntity = mockEntityWithUniqueId();
List<Event> laterJoiningCharacterEntityEvents = new ArrayList<>();
recordEntityEventsToList(laterJoiningCharacterEntity, laterJoiningCharacterEntityEvents);
+ VisualCharacterComponent visualComponentOfLaterJoiningCharacter = new VisualCharacterComponent();
+ Mockito.when(laterJoiningCharacterEntity.getComponent(VisualCharacterComponent.class)).thenReturn(visualComponentOfLaterJoiningCharacter);
// Joined player is not properly linked but it should not matter:
Mockito.when(laterJoiningCharacterEntity.getOwner()).thenReturn(EntityRef.NULL);
system.onActivatedVisualCharacter(OnActivatedComponent.newInstance(), laterJoiningCharacterEntity,
- new VisualCharacterComponent());
+ visualComponentOfLaterJoiningCharacter);
/*
