@Test
void testIsValidDocumentWhenDocumentIsValid() {

    final StageLocation stageLocation = mock(StageLocation.class);
    when(stageLocationFactory.getLocation(DOCUMENT_ID.toString(), DOCUMENT_TYPE))
            .thenReturn(Mono.just(stageLocation));
    when(stageLocation.size()).thenReturn(Mono.just(MAX_FILE_SIZE_IN_BYTES - 1));
    when(downloaderConfigurationProperties.getMaximumArchiveSize()).thenReturn(MAX_FILE_SIZE_IN_BYTES);
    final InputStream documentInputStream = mock(InputStream.class);
    when(stageLocation.openStream()).thenReturn(documentInputStream);
    when(documentDataParser.parseDocumentMetadata(DOCUMENT_ID, DOCUMENT_TYPE, documentInputStream))
            .thenReturn(
                    DocumentMetadata.builder()
                            .build()
            );
    final Mono<Boolean> result = underTest.isValidDocument(DOCUMENT_ID.toString(), DOCUMENT_TYPE);
    StepVerifier.create(result)
            .consumeNextWith(Assertions::assertTrue)
            .verifyComplete();
}