@Test public void testClear() { Behavior mockBehavior = mock(Behavior.class); GameObject mockObject = world.addObject(); manager.apply(mockBehavior, mockObject); manager.clear(); manager.updateLocally(mockObject, 0f); manager.updateGlobally(mockObject, 0f); inOrder(mockBehavior).verify(mockBehavior, Mockito.calls(1)).onDetach(mockObject); inOrder(mockBehavior).verify(mockBehavior, Mockito.never()).update(mockObject, 0f); }
public void clear() { for (Entry<String, List<Behavior>> behaviors : localBehaviors.entrySet()) { for (Behavior behavior : behaviors.getValue()) { behavior.onDetach(world.getObjectById(behaviors.getKey())); } } localBehaviors.clear(); globalBehaviors.clear(); }
BehaviorManager { public void clear() { for (Entry<String, List<Behavior>> behaviors : localBehaviors.entrySet()) { for (Behavior behavior : behaviors.getValue()) { behavior.onDetach(world.getObjectById(behaviors.getKey())); } } localBehaviors.clear(); globalBehaviors.clear(); } }
BehaviorManager { public void clear() { for (Entry<String, List<Behavior>> behaviors : localBehaviors.entrySet()) { for (Behavior behavior : behaviors.getValue()) { behavior.onDetach(world.getObjectById(behaviors.getKey())); } } localBehaviors.clear(); globalBehaviors.clear(); } BehaviorManager(GameWorld world); }
BehaviorManager { public void clear() { for (Entry<String, List<Behavior>> behaviors : localBehaviors.entrySet()) { for (Behavior behavior : behaviors.getValue()) { behavior.onDetach(world.getObjectById(behaviors.getKey())); } } localBehaviors.clear(); globalBehaviors.clear(); } BehaviorManager(GameWorld world); void apply(final Behavior behavior, final GameObject source); void apply(final Behavior behavior); void remove(final Behavior behavior); void remove(final GameObject source, final Behavior behavior); void remove(final GameObject source); void update(float delta); void updateGlobally(GameObject source, float delta); void updateLocally(GameObject source, float delta); void updateLocallyCompared(GameObject source, GameObject target, float delta); void updateGloballyCompared(GameObject source, GameObject target, float delta); void clear(); int getGlobalCount(); int getLocalCount(); void onStatusChange(GameObject source, boolean updateable); }
BehaviorManager { public void clear() { for (Entry<String, List<Behavior>> behaviors : localBehaviors.entrySet()) { for (Behavior behavior : behaviors.getValue()) { behavior.onDetach(world.getObjectById(behaviors.getKey())); } } localBehaviors.clear(); globalBehaviors.clear(); } BehaviorManager(GameWorld world); void apply(final Behavior behavior, final GameObject source); void apply(final Behavior behavior); void remove(final Behavior behavior); void remove(final GameObject source, final Behavior behavior); void remove(final GameObject source); void update(float delta); void updateGlobally(GameObject source, float delta); void updateLocally(GameObject source, float delta); void updateLocallyCompared(GameObject source, GameObject target, float delta); void updateGloballyCompared(GameObject source, GameObject target, float delta); void clear(); int getGlobalCount(); int getLocalCount(); void onStatusChange(GameObject source, boolean updateable);  }