WithPriority.java

1
package fr.sii.ogham.core.util;
2
3
import java.util.Comparator;
4
5
/**
6
 * Helper class to register several objects with associated priority.
7
 * 
8
 * @author Aurélien Baudet
9
 *
10
 * @param <P>
11
 *            the type of priorized object
12
 * @see PriorizedList
13
 * @see PriorityComparator
14
 */
15
public class WithPriority<P> {
16
	private final P priorized;
17
	private final int priority;
18
19
	/**
20
	 * Wraps the priorized object with a priority.
21
	 * 
22
	 * @param priorized
23
	 *            the object to priorize
24
	 * @param priority
25
	 *            the associated priority
26
	 */
27
	public WithPriority(P priorized, int priority) {
28
		super();
29
		this.priorized = priorized;
30
		this.priority = priority;
31
	}
32
33
	public P getPriorized() {
34 7 1. getPriorized : replaced return value with null for fr/sii/ogham/core/util/WithPriority::getPriorized → NO_COVERAGE
2. getPriorized : replaced return value with null for fr/sii/ogham/core/util/WithPriority::getPriorized → TIMED_OUT
3. getPriorized : replaced return value with null for fr/sii/ogham/core/util/WithPriority::getPriorized → KILLED
4. getPriorized : replaced return value with null for fr/sii/ogham/core/util/WithPriority::getPriorized → KILLED
5. getPriorized : replaced return value with null for fr/sii/ogham/core/util/WithPriority::getPriorized → KILLED
6. getPriorized : replaced return value with null for fr/sii/ogham/core/util/WithPriority::getPriorized → KILLED
7. getPriorized : replaced return value with null for fr/sii/ogham/core/util/WithPriority::getPriorized → KILLED
		return priorized;
35
	}
36
37
	public int getPriority() {
38 5 1. getPriority : replaced int return with 0 for fr/sii/ogham/core/util/WithPriority::getPriority → NO_COVERAGE
2. getPriority : replaced int return with 0 for fr/sii/ogham/core/util/WithPriority::getPriority → SURVIVED
3. getPriority : replaced int return with 0 for fr/sii/ogham/core/util/WithPriority::getPriority → KILLED
4. getPriority : replaced int return with 0 for fr/sii/ogham/core/util/WithPriority::getPriority → KILLED
5. getPriority : replaced int return with 0 for fr/sii/ogham/core/util/WithPriority::getPriority → KILLED
		return priority;
39
	}
40
41
	@Override
42
	public String toString() {
43 1 1. toString : replaced return value with "" for fr/sii/ogham/core/util/WithPriority::toString → NO_COVERAGE
		return priorized + " (priority=" + priority + ")";
44
	}
45
46
	/**
47
	 * Provide a comparator used to sort by priority. Higher priority value
48
	 * first.
49
	 * 
50
	 * @param <P>
51
	 *            the type of priorized object
52
	 * @return the comparator
53
	 */
54
	public static <P> Comparator<WithPriority<P>> comparator() {
55 7 1. comparator : replaced return value with null for fr/sii/ogham/core/util/WithPriority::comparator → NO_COVERAGE
2. comparator : replaced return value with null for fr/sii/ogham/core/util/WithPriority::comparator → TIMED_OUT
3. comparator : replaced return value with null for fr/sii/ogham/core/util/WithPriority::comparator → KILLED
4. comparator : replaced return value with null for fr/sii/ogham/core/util/WithPriority::comparator → KILLED
5. comparator : replaced return value with null for fr/sii/ogham/core/util/WithPriority::comparator → KILLED
6. comparator : replaced return value with null for fr/sii/ogham/core/util/WithPriority::comparator → KILLED
7. comparator : replaced return value with null for fr/sii/ogham/core/util/WithPriority::comparator → KILLED
		return new PriorityComparator<>(WithPriority::getPriority);
56
	}
57
}

Mutations

34

1.1
Location : getPriorized
Killed by : none
replaced return value with null for fr/sii/ogham/core/util/WithPriority::getPriorized → TIMED_OUT

2.2
Location : getPriorized
Killed by : oghamjavamail.it.builder.JavaMailCustomConfigurationTest.noHostDefinedShouldFail(oghamjavamail.it.builder.JavaMailCustomConfigurationTest)
replaced return value with null for fr/sii/ogham/core/util/WithPriority::getPriorized → KILLED

3.3
Location : getPriorized
Killed by : oghamsmsglobal.it.SmsglobalServiceProviderConfigurerSpec
replaced return value with null for fr/sii/ogham/core/util/WithPriority::getPriorized → KILLED

4.4
Location : getPriorized
Killed by : none
replaced return value with null for fr/sii/ogham/core/util/WithPriority::getPriorized → NO_COVERAGE

5.5
Location : getPriorized
Killed by : oghamcloudhopper.it.PartialConfigurationTest.splitterEnabledAndAutoGuessEnabledAndGsm7bitEncodingConfiguredAndLongMessageWithUnsupportedCharactersShouldFailIndicatingThatMessageCantBeSplit(oghamcloudhopper.it.PartialConfigurationTest)
replaced return value with null for fr/sii/ogham/core/util/WithPriority::getPriorized → KILLED

6.6
Location : getPriorized
Killed by : oghamcore.it.core.builder.TemplatePrioritySpec
replaced return value with null for fr/sii/ogham/core/util/WithPriority::getPriorized → KILLED

7.7
Location : getPriorized
Killed by : oghamall.it.configuration.EmptyBuilderTest.emailSenderManuallyRegisteredButUnconfiguredTemplateParsersCantHandleMultiTemplateContent(oghamall.it.configuration.EmptyBuilderTest)
replaced return value with null for fr/sii/ogham/core/util/WithPriority::getPriorized → KILLED

38

1.1
Location : getPriority
Killed by : oghamcore.it.core.builder.TemplatePrioritySpec
replaced int return with 0 for fr/sii/ogham/core/util/WithPriority::getPriority → KILLED

2.2
Location : getPriority
Killed by : none
replaced int return with 0 for fr/sii/ogham/core/util/WithPriority::getPriority → NO_COVERAGE

3.3
Location : getPriority
Killed by : oghamall.it.template.TemplateErrorTest.multiTemplateNotFound(oghamall.it.template.TemplateErrorTest)
replaced int return with 0 for fr/sii/ogham/core/util/WithPriority::getPriority → KILLED

4.4
Location : getPriority
Killed by : oghamcloudhopper.it.AutoRetryExtensionTest.smsNotRetriedDueToCloudhopperError(oghamcloudhopper.it.AutoRetryExtensionTest)
replaced int return with 0 for fr/sii/ogham/core/util/WithPriority::getPriority → KILLED

5.5
Location : getPriority
Killed by : none
replaced int return with 0 for fr/sii/ogham/core/util/WithPriority::getPriority → SURVIVED

43

1.1
Location : toString
Killed by : none
replaced return value with "" for fr/sii/ogham/core/util/WithPriority::toString → NO_COVERAGE

55

1.1
Location : comparator
Killed by : oghamall.it.configuration.EmptyBuilderTest.emailSenderManuallyRegisteredAndTemplateParsersOnlyRegisteredCantHandleTemplateContentDueToResourceResolutionNotConfigured(oghamall.it.configuration.EmptyBuilderTest)
replaced return value with null for fr/sii/ogham/core/util/WithPriority::comparator → KILLED

2.2
Location : comparator
Killed by : oghamsmsglobal.it.SmsglobalServiceProviderConfigurerSpec
replaced return value with null for fr/sii/ogham/core/util/WithPriority::comparator → KILLED

3.3
Location : comparator
Killed by : none
replaced return value with null for fr/sii/ogham/core/util/WithPriority::comparator → NO_COVERAGE

4.4
Location : comparator
Killed by : none
replaced return value with null for fr/sii/ogham/core/util/WithPriority::comparator → TIMED_OUT

5.5
Location : comparator
Killed by : oghamcloudhopper.it.SpecialCharactersTest.gsm8bit(oghamcloudhopper.it.SpecialCharactersTest)
replaced return value with null for fr/sii/ogham/core/util/WithPriority::comparator → KILLED

6.6
Location : comparator
Killed by : oghamjavamail.it.UnreadableAttachmentTest.attachmentUnreadable(oghamjavamail.it.UnreadableAttachmentTest)
replaced return value with null for fr/sii/ogham/core/util/WithPriority::comparator → KILLED

7.7
Location : comparator
Killed by : oghamcore.it.core.builder.TemplatePrioritySpec
replaced return value with null for fr/sii/ogham/core/util/WithPriority::comparator → KILLED

Active mutators

Tests examined


Report generated by PIT OGHAM