PropertiesUtil.java

1
package com.jsql.util;
2
3
import org.apache.logging.log4j.LogManager;
4
import org.apache.logging.log4j.Logger;
5
6
import java.io.IOException;
7
import java.io.InputStream;
8
import java.util.Properties;
9
10
public class PropertiesUtil {
11
    
12
    /**
13
     * Log4j logger sent to view.
14
     */
15
    private static final Logger LOGGER = LogManager.getRootLogger();
16
17
    private final Properties properties = new Properties();
18
    
19
    public PropertiesUtil() {
20
        
21
        var filename = "config.properties";
22
23
        try (InputStream input = PropertiesUtil.class.getClassLoader().getResourceAsStream(filename)) {
24
            
25 1 1. <init> : negated conditional → SURVIVED
            if (input == null) {
26
                
27
                LOGGER.log(LogLevelUtil.CONSOLE_ERROR, "Properties file {} not found", filename);
28
                return;
29
            }
30
31
            // load a properties file from class path, inside static method
32
            this.getProperties().load(input);
33
            
34
        } catch (IOException e) {
35
            LOGGER.log(LogLevelUtil.CONSOLE_JAVA, e, e);
36
        }
37
    }
38
39
    public Properties getProperties() {
40 1 1. getProperties : replaced return value with null for com/jsql/util/PropertiesUtil::getProperties → KILLED
        return this.properties;
41
    }
42
}

Mutations

25

1.1
Location : <init>
Killed by : none
negated conditional → SURVIVED

40

1.1
Location : getProperties
Killed by : ParameterUtilSpock.[engine:spock]/[spec:ParameterUtilSpock]/[feature:$spock_feature_0_2]
replaced return value with null for com/jsql/util/PropertiesUtil::getProperties → KILLED

Active mutators

Tests examined


Report generated by PIT 1.16.1