Package com.funnelback.filter.api.mock
Interface MockDocuments
-
public interface MockDocumentsUse the static methods in this class to get mock document for testing.
-
-
Method Summary
Static Methods Modifier and Type Method Description static BytesDocumentmockByteDoc(java.lang.String uri, DocumentType documentType, java.util.Optional<java.nio.charset.Charset> charset, byte[] content)Creates a mock ByteDocumentstatic BytesDocumentmockEmptyByteDoc()Creates an empty byte document for test.static StringDocumentmockEmptyStringDoc()Creates an empty byte document for test.static StringDocumentmockStringDoc(java.lang.String uri, DocumentType documentType, java.lang.String content)Constructs a mock StringDocument
-
-
-
Method Detail
-
mockStringDoc
static StringDocument mockStringDoc(java.lang.String uri, DocumentType documentType, java.lang.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(java.lang.String uri, DocumentType documentType, java.util.Optional<java.nio.charset.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.
-
-