ResourceUtils.java

1
package fr.sii.ogham.core.util;
2
3
import java.nio.file.Path;
4
import java.util.StringJoiner;
5
6
/**
7
 * Utility class to handle resources
8
 * 
9
 * @author Aurélien Baudet
10
 *
11
 */
12
public final class ResourceUtils {
13
	/**
14
	 * Convert a path that is dependent on OS to a resource path (using slashes).
15
	 * 
16
	 * @param path the path to convert
17
	 * @return the converted path
18
	 */
19
	public static String toResourcePath(Path path) {
20
		StringJoiner joiner = new StringJoiner("/", path.startsWith("/") ? "/" : "", path.endsWith("/") ? "/" : "");
21
		path.forEach(p -> joiner.add(p.toString()));
22
		return joiner.toString();
23
	}
24
25
	private ResourceUtils() {
26
		super();
27
	}
28
}

Mutations

30

1.1
Location : resourceAsString
Killed by :
replaced return value with "" for fr/sii/ogham/testing/util/ResourceUtils::resourceAsString → RUN_ERROR

45

1.1
Location : resourceAsString
Killed by :
replaced return value with "" for fr/sii/ogham/testing/util/ResourceUtils::resourceAsString → RUN_ERROR

58

1.1
Location : resource
Killed by :
negated conditional → RUN_ERROR

59

1.1
Location : resource
Killed by :
negated conditional → RUN_ERROR

62

1.1
Location : resource
Killed by :
replaced return value with null for fr/sii/ogham/testing/util/ResourceUtils::resource → RUN_ERROR

Active mutators

Tests examined


Report generated by PIT 1.13.1