PackageDetailsKey key = new PackageDetailsKey("testPackage", "1.0", "testPackageType", "noarch");
MockContentContext contentContext = new MockContentContext();
MockContentServices contentServices = (MockContentServices) contentContext.getContentServices();
contentServices.setFilename("handlers/JONServerDownloadActionHandlerTest-input-1.txt");
JONServerDownloadActionHandler handler = new JONServerDownloadActionHandler();
// This would be set by the workflow
handler.setDestinationFileLocation(downloadTo.getAbsolutePath());
// Test
handler.downloadBits(key, contentContext);
// Verify
assert downloadTo.exists() : "Temporary file [" + downloadTo.getAbsoluteFile() + "] was not created";
assert downloadTo.length() > 0 : "No data written to temporary file [" + downloadTo.getAbsoluteFile() + "]";