Package com.funnelback.filter.api.mock
Interface MockDocuments
-
public interface MockDocuments
Use the static methods in this class to get mock document for testing.
-
-
Method Summary
Static Methods Modifier and Type Method Description static BytesDocument
mockByteDoc(String uri, DocumentType documentType, Optional<Charset> charset, byte[] content)
Creates a mock ByteDocumentstatic BytesDocument
mockEmptyByteDoc()
Creates an empty byte document for test.static StringDocument
mockEmptyStringDoc()
Creates an empty byte document for test.static StringDocument
mockStringDoc(String uri, DocumentType documentType, String content)
Constructs a mock StringDocument
-
-
-
Method Detail
-
mockStringDoc
static StringDocument mockStringDoc(String uri, DocumentType documentType, String content)
Constructs a mock StringDocumentcloneWith 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 documentcontent
- 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(String uri, DocumentType documentType, Optional<Charset> charset, byte[] content)
Creates a mock ByteDocumentcloneWith 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 otherwiseOptional.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.
-
-