### Question:
GameObjectInstanceAddedToSceneCondition implements Condition { @Override public ConditionResult appliesTo(GameScene aScene, GameEvent aEvent) { if (aEvent instanceof GameObjectInstanceAddedToScene) { GameObjectInstanceAddedToScene theEvent = (GameObjectInstanceAddedToScene) aEvent; GameObjectInstance theInstance = theEvent.instance; if (theInstance.getOwnerGameObject() == gameObject.get()) { return new ConditionResult(true, aEvent, new GameObjectInstance[] {theInstance}); } } return ConditionResult.NOT_FULFILLED; } @UsedByReflection  GameObjectInstanceAddedToSceneCondition(); Property<GameObject> gameObjectProperty(); @Override ConditionResult appliesTo(GameScene aScene, GameEvent aEvent); @Override Map<String, Object> serialize(); static GameObjectInstanceAddedToSceneCondition unmarshall(GameScene aGameScene, Map<String, Object> aSerializedData); static final String GAME_OBJECT_PROPERTY; }### Answer:
@Test public void testAppliesTo() throws Exception { GameObjectInstanceAddedToSceneCondition theCondition = new GameObjectInstanceAddedToSceneCondition(); GameScene theScene = mock(GameScene.class); GameObject theObject = mock(GameObject.class); GameObjectInstance theInstance = mock(GameObjectInstance.class); when(theInstance.getOwnerGameObject()).thenReturn(theObject); GameObjectInstanceAddedToScene theEvent = new GameObjectInstanceAddedToScene(theInstance); assertSame(ConditionResult.NOT_FULFILLED, theCondition.appliesTo(theScene, new SceneShutdown())); assertSame(ConditionResult.NOT_FULFILLED, theCondition.appliesTo(theScene, theEvent)); theCondition.gameObjectProperty().set(theObject); ConditionResult theResult = theCondition.appliesTo(theScene, theEvent); assertTrue(theResult.isConditionTrue()); assertSame(theEvent, theResult.getEvent()); assertEquals(1, theResult.getAffectedInstances().length); assertSame(theInstance, theResult.getAffectedInstances()[0]); }