anchor.diff:          _ -> error
       end.
   
  +
  +mock_logger() ->
  +    meck:new(logger, [passthrough]),
  +    meck:expect(logger, should_log, fun(_) -> false end).
  +
  +
  +unmock_logger() ->
  +    ?assert(meck:validate(logger)),
  +    ?assertEqual(ok, meck:unload(logger)).
  +
  +
  +unmock_file() ->
  +    ?assert(meck:validate(file)),
  +    ?assertEqual(ok, meck:unload(file)).
  +
   -endif.
positive.code:      MonState3 = monitoring:update(MonState2),
       ?assertEqual(monitoring:cpu_usage(MonState3), 0.0),
       ?assertEqual(monitoring:mem_usage(MonState3), 0.0),
       ?assertEqual(monitoring:net_usage(MonState3), 0.0),
       ?assert(meck:validate(file)),
       ?assertEqual(ok, meck:unload(file)),
       ?assert(meck:validate(logger)),
       ?assertEqual(ok, meck:unload(logger)).
  
  
  
  
  %% ====================================================================
  
negative.code: 
  
  get_single_core_cpu_stats_test() ->
      {setup,
          fun() ->
              SampleFile = create_sample_cpu_stats_file(1),
              ?assertNotEqual(error, SampleFile),
              ExpectedCpuStats = [{<<"cpu">>, 100 * 60 / 450}],
              {ok, Fd} = SampleFile,
              meck:new(file, [unstick, passthrough]),
              meck:expect(file, open, fun("/proc/stat", [read]) -> {ok, Fd} end),
              ExpectedCpuStats
          end,
          fun(_) ->
              ?assert(meck:validate(file)),
              ?assertEqual(ok, meck:unload(file))
          end,
          fun get_single_core_cpu_stats/1
      }.
  
  
  get_multi_core_cpu_stats_test() ->
      {setup,
          fun() ->
              SampleFile = create_sample_cpu_stats_file(4),
              ?assertNotEqual(error, SampleFile),
              ExpectedCpuStats = [{<<"cpu">>, 100 * 60 / 450}, {<<"core0">>, 100 * 60 / 450}, {<<"core1">>, 100 * 60 / 450},
                  {<<"core2">>, 100 * 60 / 450}, {<<"core3">>, 100 * 60 / 450}],
              {ok, Fd} = SampleFile,
              meck:new(file, [unstick, passthrough]),
              meck:expect(file, open, fun("/proc/stat", [read]) -> {ok, Fd} end),
              ExpectedCpuStats
          end,
          fun(_) ->
              ?assert(meck:validate(file)),
              ?assertEqual(ok, meck:unload(file))
          end,
          fun get_multi_core_cpu_stats/1
      }.
  
  
   get_cpu_stats_error_test() ->
       {setup,
           fun() ->
               meck:new(file, [unstick, passthrough]),
               meck:expect(file, open, fun("/proc/stat", [read]) -> {error, test_error} end),
               %% TODO logger:should_log is mocked because it fails because
               %% TODO there is no logger_plugin module
               meck:new(logger, [passthrough]),
               meck:expect(logger, should_log, fun(_) -> false end)
           end,
           fun(_) ->
               ?assert(meck:validate(logger)),
               ?assertEqual(ok, meck:unload(logger)),
               ?assert(meck:validate(file)),
               ?assertEqual(ok, meck:unload(file))
           end,
           fun get_cpu_stats_error/0
       }.
  
  
   get_memory_stats_test() ->
       {setup,
           fun() ->
               SampleFile = create_sample_memory_stats_file(),
               ?assertNotEqual(error, SampleFile),
               {ok, Fd, ExpectedMemoryStats} = SampleFile,
               meck:new(file, [unstick, passthrough]),
               meck:expect(file, open, fun("/proc/meminfo", [read]) -> {ok, Fd} end),
               ExpectedMemoryStats
           end,
           fun(_) ->
               ?assert(meck:validate(file)),
               ?assertEqual(ok, meck:unload(file))
           end,
           fun get_memory_stats/1
       }.
  
  
   get_memory_stats_error_test() ->
       {setup,
           fun() ->
              meck:new(file, [unstick, passthrough]),
              meck:expect(file, open, fun("/proc/meminfo", [read]) -> error end),
              %% TODO logger:should_log is mocked because it
              %% TODO fails because there is no logger_plugin module
              mock_logger()
           end,
           fun(_) ->
              unmock_logger(),
              unmock_file()
           end,
          fun get_memory_stats_error/0
       }.
  
  
   calculate_network_stats_test() ->
  