mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-01-18 09:37:38 +01:00
UTs on Windows when project path contains space & some exception review
This commit is contained in:
@@ -44,7 +44,7 @@ public class ChecksumTest {
|
||||
@Test
|
||||
public void testGetChecksum() throws Exception {
|
||||
String algorithm = "MD5";
|
||||
File file = new File(this.getClass().getClassLoader().getResource("checkSumTest.file").getPath());
|
||||
File file = new File(this.getClass().getClassLoader().getResource("checkSumTest.file").toURI().getPath());
|
||||
byte[] expResult = {-16, -111, 92, 95, 70, -72, -49, -94, -125, -27, -83, 103, -96, -101, 55, -109};
|
||||
byte[] result = Checksum.getChecksum(algorithm, file);
|
||||
boolean arraysAreEqual = true;
|
||||
@@ -94,7 +94,7 @@ public class ChecksumTest {
|
||||
*/
|
||||
@Test
|
||||
public void testGetMD5Checksum() throws Exception {
|
||||
File file = new File(this.getClass().getClassLoader().getResource("checkSumTest.file").getPath());
|
||||
File file = new File(this.getClass().getClassLoader().getResource("checkSumTest.file").toURI().getPath());
|
||||
//String expResult = "F0915C5F46B8CFA283E5AD67A09B3793";
|
||||
String expResult = "f0915c5f46b8cfa283e5ad67a09b3793";
|
||||
String result = Checksum.getMD5Checksum(file);
|
||||
@@ -108,7 +108,7 @@ public class ChecksumTest {
|
||||
*/
|
||||
@Test
|
||||
public void testGetSHA1Checksum() throws Exception {
|
||||
File file = new File(this.getClass().getClassLoader().getResource("checkSumTest.file").getPath());
|
||||
File file = new File(this.getClass().getClassLoader().getResource("checkSumTest.file").toURI().getPath());
|
||||
//String expResult = "B8A9FF28B21BCB1D0B50E24A5243D8B51766851A";
|
||||
String expResult = "b8a9ff28b21bcb1d0b50e24a5243d8b51766851a";
|
||||
String result = Checksum.getSHA1Checksum(file);
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
package org.owasp.dependencycheck.utils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import org.junit.Test;
|
||||
import org.owasp.dependencycheck.utils.Downloader;
|
||||
@@ -31,9 +30,7 @@ public class DownloaderTest {
|
||||
|
||||
@Test
|
||||
public void testGetLastModified_file() throws Exception {
|
||||
File f = new File("target/test-classes/dependencycheck.properties");
|
||||
URL url = new URL("file:///" + f.getCanonicalPath());
|
||||
long timestamp = Downloader.getLastModified(url);
|
||||
long timestamp = Downloader.getLastModified(new File("target/test-classes/dependencycheck.properties").toURI().toURL());
|
||||
assertTrue("timestamp equal to zero?", timestamp > 0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user