@Test
public void testGetMessage() throws Exception {

    final String baseMessage = "baseMessage";
    final Exception baseError = new Exception(baseMessage);
    final Function<String, String> expectMessage = prefix ->
            prefix + baseError.getClass().getName() + ": " + baseError.getMessage();
    AbortedScanException aseNoPackage = new AbortedScanException(baseError);
    assertEquals("no package has base message", expectMessage.apply(""), aseNoPackage.getMessage());
    File file = TestPackageUtil.prepareTestPackage("package_1.0.zip");
    AbortedScanException aseFile = new AbortedScanException(baseError, file);
    assertEquals("file package package has prefix",
            expectMessage.apply("(Failed package: " + file.getAbsolutePath() + ") "),
            aseFile.getMessage());
    final URL url = file.toURI().toURL();
    AbortedScanException aseUrl = new AbortedScanException(baseError, url);
    assertEquals("url package package has prefix",
            expectMessage.apply("(Failed package: " + url.toString() + ") "),
            aseUrl.getMessage());
    Node node = mock(Node.class);
    final String path = "/etc/packages/correct/path";
    when(node.getPath()).thenReturn(path);
    AbortedScanException aseNode = new AbortedScanException(baseError, node);
    assertEquals("node package package has prefix",
            expectMessage.apply("(Failed package: " + path + ") "),
            aseNode.getMessage());
}