anchor.diff:  
   clear([], Config)    -> Config;
   clear([H|T], Config) -> clear(T, lists:keydelete(H, 1, Config)).
  +
  
positive.code: init_per_testcase(_Case, Config) ->
      %% Mock net_adm:ping/1 for health_checks
      meck:new(net_adm, [unstick]),
      %% Mock the topology
      meck:new(myxi_topology),
      meck:expect(myxi_topology, add_endpoints, 1, ok),
      %% Start the balancer with this module as the callback
      {ok, Balancer} = myxi_balancer:start_link(?BALANCER, ?MODULE, [], [], 0),
      [{mocks, [net_adm, myxi_topology]}, {balancer, Balancer}|Config].
  
  end_per_testcase(_Case, Config) ->
      meck:unload(?config(mocks, Config)),
      myxi_balancer:stop(?config(balancer, Config)),
      clear([mocks, balancer], Config).
  
  all() -> [add_endpoints, register_balancer].
  
  %%
  %% Tests
  
negative.code: 
  add_endpoints(Config) ->
      Pid = ?config(balancer, Config),
      Args = ?config(endpoints, Config),
      ?assert(meck:called(myxi_topology, add_endpoints, [Args], Pid)).
  
  register_balancer(_Config) ->
      ?assert(is_pid(whereis(?BALANCER))).
  
  endpoints_up(Config) ->
      [?assertEqual({ok, {A, []}}, myxi_balancer:next(?BALANCER)) ||
          A <- ?config(endpoints, Config)].
  
  endpoints_down(Config) ->
      meck:expect(net_adm, ping, 1, pang),
      ?BALANCER ! ?UP,
      erlang:bump_reductions(2000),
      [?assertEqual({error, down}, myxi_balancer:next(?BALANCER)) ||
          _A <- ?config(endpoints, Config)].
  
  %%
  %% Helpers
  