Source:
public void testSendingOfCreateVisualCharacterEvent() { EntityRef clientEntity = mockEntityWithUniqueId(); EntityRef otherClientEntity = mockEntityWithUniqueId(); EntityRef ownCharacterEntity = mockEntityWithUniqueId(); List<Event> ownCharacterEntityEvents = new ArrayList<>(); recordEntityEventsToList(ownCharacterEntity, ownCharacterEntityEvents); EntityRef otherCharacterEntity = mockEntityWithUniqueId(); List<Event> otherCharacterEntityEvents = new ArrayList<>(); recordEntityEventsToList(otherCharacterEntity, otherCharacterEntityEvents); clientEntityReturnedByLocalPlayer = EntityRef.NULL; system.onActivatedVisualCharacter(OnActivatedComponent.newInstance(), otherCharacterEntity); system.onActivatedVisualCharacter(OnActivatedComponent.newInstance(), ownCharacterEntity); simulateProperLinkingOfLocalPlayerAndCharacterEntities(clientEntity, otherClientEntity, ownCharacterEntity, otherCharacterEntity); system.onAwaitedLocalCharacterSpawnEvent(new AwaitedLocalCharacterSpawnEvent(), ownCharacterEntity); assertTypesInListEqual(ownCharacterEntityEvents, Collections.emptyList()); assertTypesInListEqual(otherCharacterEntityEvents, Arrays.asList(CreateVisualCharacterEvent.class)); EntityRef laterJoiningCharacterEntity = mockEntityWithUniqueId(); List<Event> laterJoiningCharacterEntityEvents = new ArrayList<>(); recordEntityEventsToList(laterJoiningCharacterEntity, laterJoiningCharacterEntityEvents); Mockito.when(laterJoiningCharacterEntity.getOwner()).thenReturn(EntityRef.NULL); system.onActivatedVisualCharacter(OnActivatedComponent.newInstance(), laterJoiningCharacterEntity); assertTypesInListEqual(laterJoiningCharacterEntityEvents, Arrays.asList(CreateVisualCharacterEvent.class)); }

Target:
public void testSendingOfCreateVisualCharacterEvent() { EntityRef clientEntity = mockEntityWithUniqueId(); EntityRef otherClientEntity = mockEntityWithUniqueId(); EntityRef ownCharacterEntity = mockEntityWithUniqueId(); List<Event> ownCharacterEntityEvents = new ArrayList<>(); recordEntityEventsToList(ownCharacterEntity, ownCharacterEntityEvents); VisualCharacterComponent visualComponentOfOwnCharacter = new VisualCharacterComponent(); Mockito.when(ownCharacterEntity.getComponent(VisualCharacterComponent.class)).thenReturn(visualComponentOfOwnCharacter); EntityRef otherCharacterEntity = mockEntityWithUniqueId(); List<Event> otherCharacterEntityEvents = new ArrayList<>(); recordEntityEventsToList(otherCharacterEntity, otherCharacterEntityEvents); clientEntityReturnedByLocalPlayer = EntityRef.NULL; system.onActivatedVisualCharacter(OnActivatedComponent.newInstance(), otherCharacterEntity, new VisualCharacterComponent()); system.onActivatedVisualCharacter(OnActivatedComponent.newInstance(), ownCharacterEntity, visualComponentOfOwnCharacter); simulateProperLinkingOfLocalPlayerAndCharacterEntities(clientEntity, otherClientEntity, ownCharacterEntity, otherCharacterEntity); system.onAwaitedLocalCharacterSpawnEvent(new AwaitedLocalCharacterSpawnEvent(), ownCharacterEntity); assertTypesInListEqual(ownCharacterEntityEvents, Collections.emptyList()); assertTypesInListEqual(otherCharacterEntityEvents, Arrays.asList(CreateVisualCharacterEvent.class)); EntityRef laterJoiningCharacterEntity = mockEntityWithUniqueId(); List<Event> laterJoiningCharacterEntityEvents = new ArrayList<>(); recordEntityEventsToList(laterJoiningCharacterEntity, laterJoiningCharacterEntityEvents); Mockito.when(laterJoiningCharacterEntity.getOwner()).thenReturn(EntityRef.NULL); system.onActivatedVisualCharacter(OnActivatedComponent.newInstance(), laterJoiningCharacterEntity, new VisualCharacterComponent()); assertTypesInListEqual(laterJoiningCharacterEntityEvents, Arrays.asList(CreateVisualCharacterEvent.class)); }