@Test void testBadAbsolutePathRead() { String mtar = SAMPLE_MTAR_WITH_JAR_ENTRY_ABSOLUTE_PATH; String fileName = "/web/"; String expectedException = MessageFormat.format(FileUtils.PATH_SHOULD_NOT_BE_ABSOLUTE, "/web/"); long maxFileUploadSize = MAX_UPLOAD_FILE_SIZE; ApplicationArchiveContext applicationArchiveContext = getApplicationArchiveContext(mtar, fileName, maxFileUploadSize); ApplicationArchiveReader reader = getApplicationArchiveReaderForAbsolutePath(); Exception exception = Assertions.assertThrows(Exception.class, () -> reader.calculateApplicationDigest(applicationArchiveContext)); assertEquals(expectedException, exception.getMessage()); }
public String calculateApplicationDigest(ApplicationArchiveContext applicationArchiveContext) { try { iterateApplicationArchive(applicationArchiveContext); return applicationArchiveContext.getApplicationDigestCalculator() .getDigest(); } catch (IOException e) { throw new SLException(e, Messages.ERROR_RETRIEVING_MTA_MODULE_CONTENT, applicationArchiveContext.getModuleFileName()); } }
ApplicationArchiveReader { public String calculateApplicationDigest(ApplicationArchiveContext applicationArchiveContext) { try { iterateApplicationArchive(applicationArchiveContext); return applicationArchiveContext.getApplicationDigestCalculator() .getDigest(); } catch (IOException e) { throw new SLException(e, Messages.ERROR_RETRIEVING_MTA_MODULE_CONTENT, applicationArchiveContext.getModuleFileName()); } } }
ApplicationArchiveReader { public String calculateApplicationDigest(ApplicationArchiveContext applicationArchiveContext) { try { iterateApplicationArchive(applicationArchiveContext); return applicationArchiveContext.getApplicationDigestCalculator() .getDigest(); } catch (IOException e) { throw new SLException(e, Messages.ERROR_RETRIEVING_MTA_MODULE_CONTENT, applicationArchiveContext.getModuleFileName()); } }  }
ApplicationArchiveReader { public String calculateApplicationDigest(ApplicationArchiveContext applicationArchiveContext) { try { iterateApplicationArchive(applicationArchiveContext); return applicationArchiveContext.getApplicationDigestCalculator() .getDigest(); } catch (IOException e) { throw new SLException(e, Messages.ERROR_RETRIEVING_MTA_MODULE_CONTENT, applicationArchiveContext.getModuleFileName()); } }  String calculateApplicationDigest(ApplicationArchiveContext applicationArchiveContext); ZipEntry getFirstZipEntry(ApplicationArchiveContext applicationArchiveContext); ZipEntry getNextEntryByName(String name, ApplicationArchiveContext applicationArchiveContext); }
ApplicationArchiveReader { public String calculateApplicationDigest(ApplicationArchiveContext applicationArchiveContext) { try { iterateApplicationArchive(applicationArchiveContext); return applicationArchiveContext.getApplicationDigestCalculator() .getDigest(); } catch (IOException e) { throw new SLException(e, Messages.ERROR_RETRIEVING_MTA_MODULE_CONTENT, applicationArchiveContext.getModuleFileName()); } }  String calculateApplicationDigest(ApplicationArchiveContext applicationArchiveContext); ZipEntry getFirstZipEntry(ApplicationArchiveContext applicationArchiveContext); ZipEntry getNextEntryByName(String name, ApplicationArchiveContext applicationArchiveContext);  }