@Test public void testCreate() throws Exception { GameEventManager theEventManager = mock(GameEventManager.class); GameScene theScene = mock(GameScene.class); GameObject theOwner = mock(GameObject.class); GameRuntime theRuntime = mock(GameRuntime.class); when(theOwner.getGameScene()).thenReturn(theScene); when(theScene.getRuntime()).thenReturn(theRuntime); when(theRuntime.getEventManager()).thenReturn(theEventManager); GameObjectInstance theInstance = mock(GameObjectInstance.class); when(theInstance.getOwnerGameObject()).thenReturn(theOwner); SpriteBehaviorTemplate theTemplate = new SpriteBehaviorTemplate(theEventManager, theOwner); Animation theAnimation = new Animation("Test"); theTemplate.currentAnimationProperty().set(theAnimation); theTemplate.speedProperty().set(10); SpriteBehavior theBehavior = theTemplate.create(theInstance, theRuntime); assertSame(theAnimation, theBehavior.currentAnimationProperty().get()); assertEquals(Integer.valueOf(10), theBehavior.speedProperty().get()); }
@Override public SpriteBehavior create(GameObjectInstance aInstance, GameRuntime aGameRuntime) { return new SpriteBehavior(aInstance, this); }
SpriteBehaviorTemplate implements BehaviorTemplate<SpriteBehavior>, Sprite, Reflectable<SpriteClassInformation> { @Override public SpriteBehavior create(GameObjectInstance aInstance, GameRuntime aGameRuntime) { return new SpriteBehavior(aInstance, this); } }
SpriteBehaviorTemplate implements BehaviorTemplate<SpriteBehavior>, Sprite, Reflectable<SpriteClassInformation> { @Override public SpriteBehavior create(GameObjectInstance aInstance, GameRuntime aGameRuntime) { return new SpriteBehavior(aInstance, this); } SpriteBehaviorTemplate(GameEventManager aEventManager, GameObject aOwner); }
SpriteBehaviorTemplate implements BehaviorTemplate<SpriteBehavior>, Sprite, Reflectable<SpriteClassInformation> { @Override public SpriteBehavior create(GameObjectInstance aInstance, GameRuntime aGameRuntime) { return new SpriteBehavior(aInstance, this); } SpriteBehaviorTemplate(GameEventManager aEventManager, GameObject aOwner); @Override BehaviorType getType(); @Override SpriteClassInformation getClassInformation(); @Override GameObject getOwner(); @Override SpriteBehavior create(GameObjectInstance aInstance, GameRuntime aGameRuntime); @Override Property<Animation> currentAnimationProperty(); @Override Property<Integer> speedProperty(); void addAnimation(Animation aAnimation); @Override Map<String, Object> serialize(); @Override void delete(); @Override GameScene getGameScene(); @Override Animation[] getAnimations(); void replaceAnimation(Animation aOldAnimation, Animation aNewAnimation); static SpriteBehaviorTemplate deserialize(GameEventManager aEventManager, GameObject aOwner, Map<String, Object> aSerializedData); }
SpriteBehaviorTemplate implements BehaviorTemplate<SpriteBehavior>, Sprite, Reflectable<SpriteClassInformation> { @Override public SpriteBehavior create(GameObjectInstance aInstance, GameRuntime aGameRuntime) { return new SpriteBehavior(aInstance, this); } SpriteBehaviorTemplate(GameEventManager aEventManager, GameObject aOwner); @Override BehaviorType getType(); @Override SpriteClassInformation getClassInformation(); @Override GameObject getOwner(); @Override SpriteBehavior create(GameObjectInstance aInstance, GameRuntime aGameRuntime); @Override Property<Animation> currentAnimationProperty(); @Override Property<Integer> speedProperty(); void addAnimation(Animation aAnimation); @Override Map<String, Object> serialize(); @Override void delete(); @Override GameScene getGameScene(); @Override Animation[] getAnimations(); void replaceAnimation(Animation aOldAnimation, Animation aNewAnimation); static SpriteBehaviorTemplate deserialize(GameEventManager aEventManager, GameObject aOwner, Map<String, Object> aSerializedData); static final BehaviorType TYPE; }