Interface MockDocuments


  • public interface MockDocuments
    Use the static methods in this class to get mock document for testing.
    • Method Detail

      • mockStringDoc

        static StringDocument mockStringDoc​(java.lang.String uri,
                                            DocumentType documentType,
                                            java.lang.String content)
        Constructs a mock StringDocument

        cloneWith methods may be used on the returned document to build up the required document for testing.

        Parameters:
        uri - The uri of the document.
        documentType - the mimeType of the document
        content - the content of the document.
        Returns:
        a mocked StringDocument
      • mockEmptyStringDoc

        static StringDocument mockEmptyStringDoc()
        Creates an empty byte document for test.

        Subsequent calls to this will return a document with the same URI, mime type, encoding and content. The following is true mockEmptyStringDoc().equals(mockEmptyStringDoc());

        However these values may change between versions.

        Returns:
        a mock document with an empty string as the content.
      • mockByteDoc

        static BytesDocument mockByteDoc​(java.lang.String uri,
                                         DocumentType documentType,
                                         java.util.Optional<java.nio.charset.Charset> charset,
                                         byte[] content)
        Creates a mock ByteDocument

        cloneWith methods may be used on the returned document to build up the required document for testing.

        Parameters:
        uri - to set the on the returned document.
        documentType - of the content.
        charset - of the content if known otherwise Optional.empty()
        content - to be set on the returned document.
        Returns:
        a BytesDocument with the given uri, documentType, charset and content.
      • mockEmptyByteDoc

        static BytesDocument mockEmptyByteDoc()
        Creates an empty byte document for test.

        Subsequent calls to this will return a document with the same URI, mime type and content. The following is true mockEmptyByteDoc().equals(mockEmptyByteDoc());

        Values in the document may change between versions.

        Returns:
        a ByteDocument where the content is a zero length byte array.