anchor.diff:          rpc:call(Worker1, subscription_manager, get_attr_event_subscribers, [FileGuid, undefined, false]), 10),
       rpc:call(Worker1, fslogic_event_emitter, emit_file_attr_changed_with_replication_status,
           [file_ctx:new_by_guid(FileGuid), true, []]),
  -    ?assertEqual({ok, true}, receive_replication_status()),
  +    receive_events_and_check({receive_replication_changed, true}, FileGuid),
       rpc:call(Worker1, fslogic_event_emitter, emit_file_attr_changed_with_replication_status,
           [file_ctx:new_by_guid(FileGuid), false, []]),
  -    ?assertEqual({ok, true}, receive_replication_status()),
  +    receive_events_and_check({receive_replication_changed, true}, FileGuid),
   
       % Check if single event is produced on overlapping subscriptions
       Seq2 = get_seq(Config, User),
  
positive.code: %%% Internal functions
  %%%===================================================================
  
  receive_file_removed_event() ->
      case fuse_test_utils:receive_server_message([message_stream_reset, subscription, message_request,
          message_acknowledgement, processing_status]) of
          #'ServerMessage'{
              message_body = {events, #'Events'{events = [#'Event'{
                  type = {file_removed, #'FileRemovedEvent'{}}
              }]}}
          } -> ok;
          Msg -> Msg
      end.
  
  receive_file_attr_changed_event() ->
      case fuse_test_utils:receive_server_message([message_stream_reset, subscription, message_request,
          message_acknowledgement, processing_status]) of
          #'ServerMessage'{
              message_body = {events, #'Events'{events = [#'Event'{
                  type = {file_attr_changed, #'FileAttrChangedEvent'{}}
              }]}}
          } -> ok;
          Msg -> Msg
      end.
  
  receive_replication_status() ->
      case fuse_test_utils:receive_server_message([message_stream_reset, subscription, message_request,
          message_acknowledgement, processing_status]) of
          #'ServerMessage'{
              message_body = {events, #'Events'{events = [#'Event'{
                  type = {file_attr_changed, #'FileAttrChangedEvent'{
                      file_attr = #'FileAttr'{fully_replicated = Status}}}
              }]}}
          } -> {ok, Status};
          Msg -> Msg
      end.
  
  receive_file_renamed_event() ->
      case fuse_test_utils:receive_server_message([message_stream_reset, subscription, message_request,
          message_acknowledgement, processing_status]) of
          #'ServerMessage'{
              message_body = {events, #'Events'{events = [#'Event'{
                  type = {file_renamed, #'FileRenamedEvent'{top_entry = #'FileRenamedEntry'{}}}
              }]}}
          } -> ok;
          Msg -> Msg
      end.
  
  get_seq(Config, User) ->
  
negative.code:     test_utils:mock_expect(Workers, file_meta, get_all_links, fun
          (Uuid, Name) when Name =:= ?CONFLICTING_FILE_NAME orelse Name =:= ?CONFLICTING_FILE_AFTER_RENAME ->
              case meck:passthrough([Uuid, Name]) of
                  {ok, List} -> {ok, [#link{name = Name, target = Uuid, tree_id = ?TEST_TREE_ID} | List]};
                  {error, not_found} -> {ok, [#link{name = Name, target = Uuid, tree_id = ?TEST_TREE_ID}]}
              end;
          (Uuid, Name) ->
              meck:passthrough([Uuid, Name])
  