summaryrefslogtreecommitdiffstats
path: root/utils/src/test
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2020-02-03 12:23:15 +0000
committerGerrit Code Review <gerrit@onap.org>2020-02-03 12:23:15 +0000
commit277c904618294d9a18d8c2b852f31666c996f810 (patch)
tree21c5661e2299b053b82b362dc1fac4121627694e /utils/src/test
parent8d1bac4f46bde92d76468a9e89a9a4fc52562663 (diff)
parentf6550dd7420a28f07b5c464315bbf287dfb7e360 (diff)
Merge "Fix ResourceUtilsTest junit"
Diffstat (limited to 'utils/src/test')
-rw-r--r--utils/src/test/java/org/onap/policy/common/utils/resources/ResourceUtilsTest.java22
1 files changed, 16 insertions, 6 deletions
diff --git a/utils/src/test/java/org/onap/policy/common/utils/resources/ResourceUtilsTest.java b/utils/src/test/java/org/onap/policy/common/utils/resources/ResourceUtilsTest.java
index 2991009f..8f714a49 100644
--- a/utils/src/test/java/org/onap/policy/common/utils/resources/ResourceUtilsTest.java
+++ b/utils/src/test/java/org/onap/policy/common/utils/resources/ResourceUtilsTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -321,26 +321,36 @@ public class ResourceUtilsTest {
Set<String> resultD0 = ResourceUtils.getDirectoryContents("testdir");
assertEquals(1, resultD0.size());
- assertEquals("testdir/testfile.xml", resultD0.iterator().next());
+ assertEquals("testdir/testfile.xml", normalizePath(resultD0.iterator().next()));
Set<String> resultD1 = ResourceUtils.getDirectoryContents("org/onap/policy/common");
assertTrue(resultD1.size() > 0);
- assertEquals("org/onap/policy/common/utils/", resultD1.iterator().next());
+ assertEquals("org/onap/policy/common/utils/", normalizePath(resultD1.iterator().next()));
Set<String> resultD2 = ResourceUtils.getDirectoryContents("org/onap/policy/common/utils/coder");
assertTrue(resultD2.size() >= 15);
- assertEquals("org/onap/policy/common/utils/coder/CoderExceptionTest.class", resultD2.iterator().next());
+ assertEquals("org/onap/policy/common/utils/coder/CoderExceptionTest.class",
+ normalizePath(resultD2.iterator().next()));
Set<String> resultJ0 = ResourceUtils.getDirectoryContents("com");
assertEquals(189, resultJ0.size());
- assertEquals("com/google/", resultJ0.iterator().next());
+ assertEquals("com/google/", normalizePath(resultJ0.iterator().next()));
Set<String> resultJ1 = ResourceUtils.getDirectoryContents("com/google/gson/util");
assertEquals(1, resultJ1.size());
- assertEquals("com/google/gson/util/VersionUtils.class", resultJ1.iterator().next());
+ assertEquals("com/google/gson/util/VersionUtils.class", normalizePath(resultJ1.iterator().next()));
URL dummyUrl = new URL("http://even/worse");
assertTrue(ResourceUtils.getDirectoryContentsJar(dummyUrl, "nonexistantdirectory").isEmpty());
}
+
+ /**
+ * Normalizes a path name, replacing OS-specific separators with "/".
+ * @param pathName path name to be normalized
+ * @return the normalized path name
+ */
+ private String normalizePath(String pathName) {
+ return pathName.replace(File.separator, "/");
+ }
}