PropertiesUtils.java

1
package fr.sii.ogham.spring.util;
2
3
import java.lang.reflect.Array;
4
import java.util.List;
5
6
/**
7
 * Some utility functions to handle properties
8
 * 
9
 * @author Aurélien Baudet
10
 *
11
 */
12
public final class PropertiesUtils {
13
14
	/**
15
	 * Converts the list of values to an array.
16
	 * 
17
	 * <p>
18
	 * If the list is {@code null}, {@code null} is returned.
19
	 * 
20
	 * 
21
	 * @param <E>
22
	 *            the type of elements
23
	 * @param list
24
	 *            the list to convert
25
	 * @param type
26
	 *            the type of the elements (can't be determined automatically
27
	 *            through reflection)
28
	 * @return the array
29
	 */
30
	@SuppressWarnings({ "unchecked", "squid:S1168" })
31
	public static <E> E[] asArray(List<? extends E> list, Class<E> type) {
32 2 1. asArray : negated conditional → KILLED
2. asArray : negated conditional → KILLED
		if (list == null) {
33
			return null;
34
		}
35 1 1. asArray : replaced return value with null for fr/sii/ogham/spring/util/PropertiesUtils::asArray → NO_COVERAGE
		return list.toArray((E[]) Array.newInstance(type, list.size()));
36
	}
37
38
	private PropertiesUtils() {
39
		super();
40
	}
41
}

Mutations

32

1.1
Location : asArray
Killed by : oghamspringbootv1autoconfigure.it.OghamSpringBoot1JavaMailAutoConfigurationTests.oghamAloneShouldUseOghamProperties(oghamspringbootv1autoconfigure.it.OghamSpringBoot1JavaMailAutoConfigurationTests)
negated conditional → KILLED

2.2
Location : asArray
Killed by : oghamspringbootv2autoconfigure.it.OghamSpringBoot2JavaMailAutoConfigurationTests.oghamPropertiesWithSpringPropsShouldUseOghamPropertiesPrecedence(oghamspringbootv2autoconfigure.it.OghamSpringBoot2JavaMailAutoConfigurationTests)
negated conditional → KILLED

35

1.1
Location : asArray
Killed by : none
replaced return value with null for fr/sii/ogham/spring/util/PropertiesUtils::asArray → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT OGHAM