mirror of https://github.com/apache/poi.git
Fix expected exception text and print out which FileHandler failed in integration-tests
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1911495 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1e8e95c3a6
commit
6f054ddce1
|
@ -184,7 +184,7 @@ public class TestAllFiles {
|
||||||
FileHandler fileHandler = handler.getHandler();
|
FileHandler fileHandler = handler.getHandler();
|
||||||
assertNotNull(fileHandler, "Did not find a handler for file " + file);
|
assertNotNull(fileHandler, "Did not find a handler for file " + file);
|
||||||
Executable exec = () -> fileHandler.handleExtracting(new File(ROOT_DIR, file));
|
Executable exec = () -> fileHandler.handleExtracting(new File(ROOT_DIR, file));
|
||||||
verify(file, exec, exClass, exMessage, password);
|
verify(file, exec, exClass, exMessage, password, fileHandler);
|
||||||
} finally {
|
} finally {
|
||||||
Thread.currentThread().setName(threadName);
|
Thread.currentThread().setName(threadName);
|
||||||
}
|
}
|
||||||
|
@ -205,7 +205,7 @@ public class TestAllFiles {
|
||||||
assertNotNull(fileHandler, "Did not find a handler for file " + file);
|
assertNotNull(fileHandler, "Did not find a handler for file " + file);
|
||||||
try (InputStream stream = new BufferedInputStream(new FileInputStream(new File(ROOT_DIR, file)), 64 * 1024)) {
|
try (InputStream stream = new BufferedInputStream(new FileInputStream(new File(ROOT_DIR, file)), 64 * 1024)) {
|
||||||
Executable exec = () -> fileHandler.handleFile(stream, file);
|
Executable exec = () -> fileHandler.handleFile(stream, file);
|
||||||
verify(file, exec, exClass, exMessage, password);
|
verify(file, exec, exClass, exMessage, password, fileHandler);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
Thread.currentThread().setName(threadName);
|
Thread.currentThread().setName(threadName);
|
||||||
|
@ -226,15 +226,16 @@ public class TestAllFiles {
|
||||||
FileHandler fileHandler = handler.getHandler();
|
FileHandler fileHandler = handler.getHandler();
|
||||||
assertNotNull(fileHandler, "Did not find a handler for file " + file);
|
assertNotNull(fileHandler, "Did not find a handler for file " + file);
|
||||||
Executable exec = () -> fileHandler.handleAdditional(new File(ROOT_DIR, file));
|
Executable exec = () -> fileHandler.handleAdditional(new File(ROOT_DIR, file));
|
||||||
verify(file, exec, exClass, exMessage, password);
|
verify(file, exec, exClass, exMessage, password, fileHandler);
|
||||||
} finally {
|
} finally {
|
||||||
Thread.currentThread().setName(threadName);
|
Thread.currentThread().setName(threadName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private static void verify(String file, Executable exec, Class<? extends Throwable> exClass, String exMessage, String password) {
|
private static void verify(String file, Executable exec, Class<? extends Throwable> exClass, String exMessage, String password,
|
||||||
final String errPrefix = file + " - failed. ";
|
FileHandler fileHandler) {
|
||||||
|
final String errPrefix = file + " - failed for handler " + fileHandler.getClass().getSimpleName() + ": ";
|
||||||
// this also removes the password for non encrypted files
|
// this also removes the password for non encrypted files
|
||||||
Biff8EncryptionKey.setCurrentUserPassword(password);
|
Biff8EncryptionKey.setCurrentUserPassword(password);
|
||||||
if (exClass != null && AssertionFailedError.class.isAssignableFrom(exClass)) {
|
if (exClass != null && AssertionFailedError.class.isAssignableFrom(exClass)) {
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue