RelativePath.java

1
package fr.sii.ogham.core.resource.path;
2
3
import fr.sii.ogham.core.util.EqualsBuilder;
4
import fr.sii.ogham.core.util.HashCodeBuilder;
5
6
/**
7
 * A generated path from a base path and a relative path.
8
 * 
9
 * @author Aurélien Baudet
10
 *
11
 */
12
public class RelativePath implements ResourcePath {
13
	/**
14
	 * The base path
15
	 */
16
	private final ResourcePath basePath;
17
	/**
18
	 * The path to resolve against source path
19
	 */
20
	private final ResourcePath relativePath;
21
	/**
22
	 * The resolution result
23
	 */
24
	private final String mergedPath;
25
26
	public RelativePath(ResourcePath base, ResourcePath relative, String mergedPath) {
27
		super();
28
		this.basePath = base;
29
		this.relativePath = relative;
30
		this.mergedPath = mergedPath;
31
	}
32
33
	public RelativePath(ResourcePath base, String relativePath, String mergedPath) {
34
		this(base, new UnresolvedPath(relativePath), mergedPath);
35
	}
36
37
	/**
38
	 * Get the path as string of the resource before any resolution attempt.
39
	 * 
40
	 * This path is the relative path merged with the base path.
41
	 * 
42
	 * @return the merge path
43
	 */
44
	@Override
45
	public String getOriginalPath() {
46 3 1. getOriginalPath : replaced return value with "" for fr/sii/ogham/core/resource/path/RelativePath::getOriginalPath → NO_COVERAGE
2. getOriginalPath : replaced return value with "" for fr/sii/ogham/core/resource/path/RelativePath::getOriginalPath → KILLED
3. getOriginalPath : replaced return value with "" for fr/sii/ogham/core/resource/path/RelativePath::getOriginalPath → KILLED
		return mergedPath;
47
	}
48
49
	/**
50
	 * Get the base path
51
	 * 
52
	 * @return the base path
53
	 */
54
	public ResourcePath getBasePath() {
55 1 1. getBasePath : replaced return value with null for fr/sii/ogham/core/resource/path/RelativePath::getBasePath → NO_COVERAGE
		return basePath;
56
	}
57
58
	/**
59
	 * Get the relative path
60
	 * 
61
	 * @return the relative path
62
	 */
63
	public ResourcePath getRelativePath() {
64 3 1. getRelativePath : replaced return value with null for fr/sii/ogham/core/resource/path/RelativePath::getRelativePath → NO_COVERAGE
2. getRelativePath : replaced return value with null for fr/sii/ogham/core/resource/path/RelativePath::getRelativePath → KILLED
3. getRelativePath : replaced return value with null for fr/sii/ogham/core/resource/path/RelativePath::getRelativePath → KILLED
		return relativePath;
65
	}
66
67
	@Override
68
	public int hashCode() {
69 1 1. hashCode : replaced int return with 0 for fr/sii/ogham/core/resource/path/RelativePath::hashCode → NO_COVERAGE
		return new HashCodeBuilder().append(basePath).append(relativePath).hashCode();
70
	}
71
72
	@Override
73
	public boolean equals(Object obj) {
74 2 1. equals : replaced boolean return with false for fr/sii/ogham/core/resource/path/RelativePath::equals → NO_COVERAGE
2. equals : replaced boolean return with true for fr/sii/ogham/core/resource/path/RelativePath::equals → NO_COVERAGE
		return new EqualsBuilder(this, obj).appendFields("basePath", "relativePath").isEqual();
75
	}
76
77
	@Override
78
	public String toString() {
79
		StringBuilder builder = new StringBuilder();
80
		builder.append("'").append(mergedPath).append("' (merged from ").append(relativePath).append(" relative to ").append(basePath).append(")");
81 3 1. toString : replaced return value with "" for fr/sii/ogham/core/resource/path/RelativePath::toString → SURVIVED
2. toString : replaced return value with "" for fr/sii/ogham/core/resource/path/RelativePath::toString → NO_COVERAGE
3. toString : replaced return value with "" for fr/sii/ogham/core/resource/path/RelativePath::toString → KILLED
		return builder.toString();
82
	}
83
}

Mutations

46

1.1
Location : getOriginalPath
Killed by : none
replaced return value with "" for fr/sii/ogham/core/resource/path/RelativePath::getOriginalPath → NO_COVERAGE

2.2
Location : getOriginalPath
Killed by : oghamall.it.html.translator.JsoupInlineCssTranslatorTest.unreadableCss(oghamall.it.html.translator.JsoupInlineCssTranslatorTest)
replaced return value with "" for fr/sii/ogham/core/resource/path/RelativePath::getOriginalPath → KILLED

3.3
Location : getOriginalPath
Killed by : oghamcore.ut.core.resource.path.LookupAwareRelativePathResolverSpec
replaced return value with "" for fr/sii/ogham/core/resource/path/RelativePath::getOriginalPath → KILLED

55

1.1
Location : getBasePath
Killed by : none
replaced return value with null for fr/sii/ogham/core/resource/path/RelativePath::getBasePath → NO_COVERAGE

64

1.1
Location : getRelativePath
Killed by : oghamcore.it.html.translator.InlineImageTranslatorTest.oghamAttributesShoulBeRemoved(oghamcore.it.html.translator.InlineImageTranslatorTest)
replaced return value with null for fr/sii/ogham/core/resource/path/RelativePath::getRelativePath → KILLED

2.2
Location : getRelativePath
Killed by : none
replaced return value with null for fr/sii/ogham/core/resource/path/RelativePath::getRelativePath → NO_COVERAGE

3.3
Location : getRelativePath
Killed by : oghamall.it.html.translator.JsoupInlineImageTranslatorTest.skipExternalImages(oghamall.it.html.translator.JsoupInlineImageTranslatorTest)
replaced return value with null for fr/sii/ogham/core/resource/path/RelativePath::getRelativePath → KILLED

69

1.1
Location : hashCode
Killed by : none
replaced int return with 0 for fr/sii/ogham/core/resource/path/RelativePath::hashCode → NO_COVERAGE

74

1.1
Location : equals
Killed by : none
replaced boolean return with false for fr/sii/ogham/core/resource/path/RelativePath::equals → NO_COVERAGE

2.2
Location : equals
Killed by : none
replaced boolean return with true for fr/sii/ogham/core/resource/path/RelativePath::equals → NO_COVERAGE

81

1.1
Location : toString
Killed by : oghamall.it.html.translator.JsoupInlineCssTranslatorTest.unreadableCss(oghamall.it.html.translator.JsoupInlineCssTranslatorTest)
replaced return value with "" for fr/sii/ogham/core/resource/path/RelativePath::toString → KILLED

2.2
Location : toString
Killed by : none
replaced return value with "" for fr/sii/ogham/core/resource/path/RelativePath::toString → SURVIVED

3.3
Location : toString
Killed by : none
replaced return value with "" for fr/sii/ogham/core/resource/path/RelativePath::toString → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT OGHAM