code: def test_to_dict_with_custom_init_parameters(self):
      mocked_docstore_class = document_store_class(
          "MockedDocumentStore"
      )
      component = DocumentWriter(
          document_store=mocked_docstore_class(),
          policy=DuplicatePolicy.SKIP,
      )
      data = component.to_dict()
      assert data == {
          "type": "haystack.components.writers.document_writer.DocumentWriter",
          "init_parameters": {
              "document_store": {
                  "type": "haystack.testing.factory.MockedDocumentStore",
                  "init_parameters": {},
              },
              "policy": "SKIP",
          },
      }
  
file_path: haystack/test/components/writers/test_document_writer.py
imports: import pytest
  from haystack import Document, DeserializationError
  from haystack.testing.factory import document_store_class
  from haystack.components.writers.document_writer import DocumentWriter
  from haystack.document_stores.types import DuplicatePolicy
  from haystack.document_stores.in_memory import InMemoryDocumentStore
label_desc: Use image node_id 2 for calling the TestDocumentWriter obj's underlying member method code with example usage: obj.test_to_dict_with_custom_init_parameters() without return types