@Test
public void requestFileOnNonzeroReturnCodeReturnsEmptyOptional() throws IOException, MavenInvocationException {

    Path targetDirectory = temporaryFolder.newFolder("target").toPath();
    final String expectedJarBaseName = mir.getExpectedJarBaseName(mavenCoordinate, ClassifierInformation.DEFAULT_JAR);
    File expectedJarFile = new File(targetDirectory.toFile(), expectedJarBaseName);
    Mockito.when(defaultInvokerMock.execute(ArgumentMatchers.any(InvocationRequest.class)))
            .then((Answer<InvocationResult>) invocationOnMock -> {
                // touch expected file
                new FileOutputStream(expectedJarFile).close();
                // return dummy result
                return getDummyInvocationResult(1);
            });
    Optional<File> requestResult = mir.requestFile(mavenCoordinate, targetDirectory, ClassifierInformation.DEFAULT_JAR);
    assertThat(requestResult).isEmpty();
}