Settings.java

1
// Copyright © 2004-2006 University of Helsinki, Department of Computer Science
2
// Copyright © 2012 various contributors
3
// This software is released under GNU Lesser General Public License 2.1.
4
// The license text is at http://www.gnu.org/licenses/lgpl-2.1.html
5
package fi.helsinki.cs.titokone;
6
7
import java.text.ParseException;
8
import java.util.*;
9
import java.util.logging.Logger;
10
11
/**
12
 * This class keeps track of the settings. It can parse and save settings
13
 * file content. It provides support for a standard set of settings, but
14
 * basically anything can be stored in it. Keys used in this file cannot
15
 * contain KEY_VALUE_SEPARATOR. Whitespace around KEY_VALUE_SEPARATOR is
16
 * ignored.
17
 */
18
public class Settings {
19
    private HashMap<String, Object> settings;
20
21
    /**
22
     * This string separates keys from values in the settings file.
23
     * It cannot be included in the key strings.
24
     */
25
    public static final String KEY_VALUE_SEPARATOR = "=";
26
    /**
27
     * This field stores the comment marker to put before any comment
28
     * lines.
29
     */
30
    private static final String COMMENT_MARKER = "#";
31
    /**
32
     * This pattern matches against 1 or more characters (there is a
33
     * start of a line in the start of each String, hence ignore the
34
     * first character), then 1 or more periods where there is at
35
     * least one start of line (\n\n would match ^^) and then 0 or
36
     * more other characters.  We assume here that since
37
     * Pattern.MULTILINE mode is on by default now, it will be on in
38
     * other places as well.
39
     */
40 6
    private static final String LINEBREAK_CHECK_REGEXP = ".+[\n\r\f" +
41
            System.getProperty("line.separator") + "]+.*";
42
43
    /**
44
     * This is one of the default settings keys of values that can be
45
     * stored here.
46
     */
47
    public static final String UI_LANGUAGE = "Language";
48
    public static final String RUN_MODE = "Running mode";
49
    public static final String COMPILE_MODE = "Compilation mode";
50
    public static final String DEFAULT_STDIN = "Stdin file";
51
    public static final String STDIN_PATH = "Stdin path";
52
    public static final String DEFAULT_STDOUT = "Stdout file";
53
    public static final String STDOUT_USE = "Stdout use";
54
    public static final String STDOUT_PATH = "Stdout path";
55
    public static final String MEMORY_SIZE = "Memory size";
56
57
    /**
58
     * This constructor sets up a settings class with default values.
59
     * The settingsFileContent is parsed with the help fo the
60
     * parseSettingsFile() method.
61
     *
62
     * @param settingsFileContent A String containing what has been in
63
     *                            a settings file for parsing.
64
     * @throws ParseException If the settings text was not syntactically
65
     *                        correct.
66
     */
67
    public Settings(String settingsFileContent) throws ParseException {
68 2
        settings = new HashMap<String, Object>();
69 1
        if (settingsFileContent != null) {
70 1
            parseSettingsFile(settingsFileContent);
71
        }
72
    }
73
74
    /**
75
     * This constructor sets up a settings class with no values.
76
     */
77
    public Settings() {
78 2
        settings = new HashMap<String, Object>();
79
    }
80
81
    /**
82
     * This method sets a key to a certain string value.
83
     *
84
     * @param key   The key to point to the value.
85
     * @param value The value to be stored.
86
     * @throws IllegalArgumentException If the given key contains
87
     *                                  KEY_VALUE_SEPARATOR or the value contains a linebreak in the
88
     *                                  middle (in the end it does not count), or if either are null.
89
     */
90
    public void setValue(String key, String value) {
91
        String expMessage;
92 2
        String[] parameters = new String[3];
93
94 4
        parameters[0] = new Message("value").toString();
95 1
        if (value == null) {
96 2
            expMessage = new Message("Illegal {0}: null. Try an empty " +
97
                    "string instead.",
98
                    parameters).toString();
99 1
            throw new IllegalArgumentException(expMessage);
100
        }
101
        // Check that the value string does not contain linebreaks
102
        // in other positions than its end.
103 6
        if (value.matches(LINEBREAK_CHECK_REGEXP + ".+")) {
104 2
            parameters[1] = value;
105 4
            parameters[2] = new Message("a linebreak").toString();
106 2
            expMessage = new Message("Illegal {0} \"{1}\", contains {2}.",
107
                    parameters).toString();
108 1
            throw new IllegalArgumentException(expMessage);
109
        }
110 1
        doSetValue(key, value);
111
    }
112
113
    /**
114
     * This method sets a key to a certain integer value.
115
     *
116
     * @param key   The key to point to the value.
117
     * @param value The value to be stored.
118
     */
119
    public void setValue(String key, int value) {
120 2
        doSetValue(key, new Integer(value));
121
    }
122
123
    /**
124
     * This method sets a key to a given object value. It checks the
125
     * key's validity, but assumes that the Object is representable
126
     * as a valid string.
127
     *
128
     * @param key   The possibly invalid key to point to the value.
129
     * @param value The value to be stored.
130
     * @throws IllegalArgumentException If the key contains
131
     *                                  KEY_VALUE_SEPARATOR or is null.
132
     */
133
    private void doSetValue(String key, Object value) {
134
        String expMessage;
135 2
        String[] parameters = new String[3];
136 4
        parameters[0] = new Message("key").toString();
137 1
        if (key == null) {
138 2
            expMessage = new Message("Illegal {0}: null. Try an empty " +
139
                    "string instead.", parameters).toString();
140 1
            throw new IllegalArgumentException(expMessage);
141
        }
142
        // The regular expression below matches any character (.)
143
        // 0 or more times (*) followed by a KEY_VALUE_SEPARATOR,
144
        // followed by any character 0 or more times.
145 2
        if (key.matches(".*" + KEY_VALUE_SEPARATOR + ".*")) {
146 2
            parameters[1] = key;
147 2
            parameters[2] = "'" + KEY_VALUE_SEPARATOR + "'";
148 2
            expMessage = new Message("Illegal {0} \"{1}\", contains {2}.",
149
                    parameters).toString();
150 1
            throw new IllegalArgumentException(expMessage);
151
        }
152 2
        if (key.matches(LINEBREAK_CHECK_REGEXP)) {
153 2
            parameters[1] = key;
154 4
            parameters[2] = new Message("a linebreak").toString();
155 2
            expMessage = new Message("Illegal {0} \"{1}\", contains {2}.",
156
                    parameters).toString();
157 1
            throw new IllegalArgumentException(expMessage);
158
        }
159 1
        settings.put(key, value);
160
    }
161
162
    /**
163
     * This method returns the value of a certain key. It will try to
164
     * cast it to an integer before returning.
165
     *
166
     * @param key The key pointing to the value to be returned.
167
     * @return The value the key points to, cast to an int.
168
     * @throws ClassCastException   If the value was not an int.
169
     * @throws NullPointerException If there was no value stored by that
170
     *                              key (or if the value stored was null for some reason). The
171
     *                              problem is that int cannot be null, while String in getStrValue
172
     *                              can.
173
     */
174
    public int getIntValue(String key) {
175 3
        return ((Integer) settings.get(key)).intValue();
176
    }
177
178
    /**
179
     * This method returns the value of a certain key. It will try to
180
     * cast it to a string before returning.
181
     *
182
     * @param key The key pointing to the value to be returned.
183
     * @return The value the key points to, cast to a String, or null
184
     *         if there was no such value.
185
     * @throws ClassCastException If the value was not a String.
186
     */
187
    public String getStrValue(String key) {
188 2
        return (String) settings.get(key);
189
    }
190
191
    /**
192
     * This method returns all the keys defined here.
193
     */
194
    public String[] getKeys() {
195 5
        return (String[]) settings.keySet().toArray(new String[0]);
196
    }
197
198
    /**
199
     * This method transforms this settings class into a format which
200
     * can be parsed by parseSettingsFile.
201
     *
202
     * @return String containing the non-fixed data in this class.
203
     */
204
    public String toString() {
205
        String keyString, valueString;
206
        StringBuffer result;
207
        Object value;
208 2
        Iterator keyIterator = settings.keySet().iterator();
209 1
        result = new StringBuffer("");
210 2
        while (keyIterator.hasNext()) {
211 1
            keyString = (String) keyIterator.next();
212 1
            value = settings.get(keyString);
213
            try {
214 1
                valueString = (String) settings.get(keyString);
215
            } catch (ClassCastException mustBeAnIntegerThen) {
216 5
                valueString = "" + ((Integer) value).intValue();
217
            }
218 10
            result.append(keyString + " " + KEY_VALUE_SEPARATOR + " " +
219
                    valueString + System.getProperty("line.separator",
220
                    "\n"));
221
        }
222 2
        return result.toString();
223
    }
224
225
    /**
226
     * This method parses the fileContent string and sets up the settings
227
     * HashMap values accordingly. It will try to cast number strings to
228
     * integers.
229
     *
230
     * @param fileContent A String containing what has been in
231
     *                    a settings file for parsing.
232
     * @throws ParseException If the settings text was not syntactically
233
     *                        correct.
234
     */
235
    private void parseSettingsFile(String fileContent)
236
            throws ParseException {
237 2
        String[] parameters = new String[2], rows, parts;
238
        String line, errorMessage, key, valueString;
239
        Logger logger;
240
241
        // We accept \n,\r and whatever this system uses as a line separator.
242
        // StringTokenizer will not mind matching against eg. \r\r; it will
243
        // be considered the same as \r.
244 7
        rows = fileContent.split("[\n\r\f" +
245
                System.getProperty("line.separator") +
246
                "]");
247 5
        for (int i = 0; i < rows.length; i++) {
248
            line = rows[i];
249
            // First, check if it is an empty line or a comment line.
250
            // Ignore those.
251
            // (Trimming does not modify the string.)
252 5
            if (!line.trim().equals("") && !line.startsWith(COMMENT_MARKER)) {
253 1
                parts = line.split(KEY_VALUE_SEPARATOR);
254
                // parts.length can be > 2, because KEY_VALUE_SEPARATOR
255
                // is allowed in the value string, even if not in the key
256
                // string.
257 4
                if (parts.length < 2) {
258
                    // Log where we failed and on what.
259 9
                    parameters[0] = "" + (i + 1);
260 2
                    parameters[1] = line;
261 2
                    errorMessage = new Message("Syntax error on line {0}, " +
262
                            "which was: \"{1}\".",
263
                            parameters).toString();
264 4
                    throw new ParseException(errorMessage, i + 1);
265
                } else { // Line has 2 (or more) parts as it should.
266 3
                    key = parts[0].trim();
267 3
                    valueString = parts[1].trim();
268
                    try {
269 2
                        setValue(key, Integer.parseInt(valueString));
270
                    } catch (NumberFormatException notAnIntegerThen) {
271 1
                        setValue(key, valueString);
272
                    }
273
                }
274
            }
275
        }
276 6
        parameters[0] = "" + rows.length;
277 7
        parameters[1] = "" + settings.size();
278
        logger = Logger.getLogger(this.getClass().getPackage().getName());
279
        logger.info(new Message("Settings successfully parsed, lines: " +
280
                "{0}, unique keys found: {1}.",
281
                parameters).toString());
282
283
    }
284
285
}

Mutations

40

removed call to java/lang/StringBuilder::<init> : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/System::getProperty : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/StringBuilder::append : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/StringBuilder::append : TIMED_OUT

removed call to java/lang/StringBuilder::append : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/StringBuilder::toString : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

68

Removed assignment to member variable settings : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/util/HashMap::<init> : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

69

negated conditional : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

70

removed call to fi/helsinki/cs/titokone/Settings::parseSettingsFile : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

78

removed call to java/util/HashMap::<init> : NO_COVERAGE

Removed assignment to member variable settings : NO_COVERAGE

92

Substituted 3 with 4 : SURVIVED

Substituted 3 with 4 : SURVIVED

94

removed call to fi/helsinki/cs/titokone/Message::<init> : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

Substituted 0 with 1 : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testSetAndGetValue(fi.helsinki.cs.titokone.SettingsTest)

removed call to fi/helsinki/cs/titokone/Message::toString : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testSetAndGetValue(fi.helsinki.cs.titokone.SettingsTest)

Substituted 0 with 1 : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testSetAndGetValue(fi.helsinki.cs.titokone.SettingsTest)

95

negated conditional : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

96

removed call to fi/helsinki/cs/titokone/Message::<init> : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testSetAndGetValue(fi.helsinki.cs.titokone.SettingsTest)

removed call to fi/helsinki/cs/titokone/Message::toString : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testSetAndGetValue(fi.helsinki.cs.titokone.SettingsTest)

99

removed call to java/lang/IllegalArgumentException::<init> : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testSetAndGetValue(fi.helsinki.cs.titokone.SettingsTest)

103

removed call to java/lang/String::matches : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testSetAndGetValue(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/StringBuilder::toString : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/StringBuilder::append : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/StringBuilder::<init> : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

negated conditional : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/StringBuilder::append : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

104

Substituted 1 with 0 : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testSetAndGetValue(fi.helsinki.cs.titokone.SettingsTest)

Substituted 1 with 0 : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testSetAndGetValue(fi.helsinki.cs.titokone.SettingsTest)

105

removed call to fi/helsinki/cs/titokone/Message::<init> : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testSetAndGetValue(fi.helsinki.cs.titokone.SettingsTest)

Substituted 2 with 3 : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testSetAndGetValue(fi.helsinki.cs.titokone.SettingsTest)

removed call to fi/helsinki/cs/titokone/Message::toString : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testSetAndGetValue(fi.helsinki.cs.titokone.SettingsTest)

Substituted 2 with 3 : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testSetAndGetValue(fi.helsinki.cs.titokone.SettingsTest)

106

removed call to fi/helsinki/cs/titokone/Message::<init> : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testSetAndGetValue(fi.helsinki.cs.titokone.SettingsTest)

removed call to fi/helsinki/cs/titokone/Message::toString : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testSetAndGetValue(fi.helsinki.cs.titokone.SettingsTest)

108

removed call to java/lang/IllegalArgumentException::<init> : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testSetAndGetValue(fi.helsinki.cs.titokone.SettingsTest)

110

removed call to fi/helsinki/cs/titokone/Settings::doSetValue : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

120

removed call to java/lang/Integer::<init> : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

removed call to fi/helsinki/cs/titokone/Settings::doSetValue : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

135

Substituted 3 with 4 : SURVIVED

Substituted 3 with 4 : SURVIVED

136

Substituted 0 with 1 : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testSetAndGetValue(fi.helsinki.cs.titokone.SettingsTest)

removed call to fi/helsinki/cs/titokone/Message::<init> : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

removed call to fi/helsinki/cs/titokone/Message::toString : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testSetAndGetValue(fi.helsinki.cs.titokone.SettingsTest)

Substituted 0 with 1 : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testSetAndGetValue(fi.helsinki.cs.titokone.SettingsTest)

137

negated conditional : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

138

removed call to fi/helsinki/cs/titokone/Message::toString : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testSetAndGetValue(fi.helsinki.cs.titokone.SettingsTest)

removed call to fi/helsinki/cs/titokone/Message::<init> : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testSetAndGetValue(fi.helsinki.cs.titokone.SettingsTest)

140

removed call to java/lang/IllegalArgumentException::<init> : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testSetAndGetValue(fi.helsinki.cs.titokone.SettingsTest)

145

removed call to java/lang/String::matches : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testSetAndGetValue(fi.helsinki.cs.titokone.SettingsTest)

negated conditional : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

146

Substituted 1 with 0 : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testSetAndGetValue(fi.helsinki.cs.titokone.SettingsTest)

Substituted 1 with 0 : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testSetAndGetValue(fi.helsinki.cs.titokone.SettingsTest)

147

Substituted 2 with 3 : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testSetAndGetValue(fi.helsinki.cs.titokone.SettingsTest)

Substituted 2 with 3 : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testSetAndGetValue(fi.helsinki.cs.titokone.SettingsTest)

148

removed call to fi/helsinki/cs/titokone/Message::toString : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testSetAndGetValue(fi.helsinki.cs.titokone.SettingsTest)

removed call to fi/helsinki/cs/titokone/Message::<init> : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testSetAndGetValue(fi.helsinki.cs.titokone.SettingsTest)

150

removed call to java/lang/IllegalArgumentException::<init> : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testSetAndGetValue(fi.helsinki.cs.titokone.SettingsTest)

152

removed call to java/lang/String::matches : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testSetAndGetValue(fi.helsinki.cs.titokone.SettingsTest)

negated conditional : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

153

Substituted 1 with 0 : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testSetAndGetValue(fi.helsinki.cs.titokone.SettingsTest)

Substituted 1 with 0 : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testSetAndGetValue(fi.helsinki.cs.titokone.SettingsTest)

154

Substituted 2 with 3 : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testSetAndGetValue(fi.helsinki.cs.titokone.SettingsTest)

removed call to fi/helsinki/cs/titokone/Message::toString : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testSetAndGetValue(fi.helsinki.cs.titokone.SettingsTest)

Substituted 2 with 3 : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testSetAndGetValue(fi.helsinki.cs.titokone.SettingsTest)

removed call to fi/helsinki/cs/titokone/Message::<init> : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testSetAndGetValue(fi.helsinki.cs.titokone.SettingsTest)

155

removed call to fi/helsinki/cs/titokone/Message::<init> : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testSetAndGetValue(fi.helsinki.cs.titokone.SettingsTest)

removed call to fi/helsinki/cs/titokone/Message::toString : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testSetAndGetValue(fi.helsinki.cs.titokone.SettingsTest)

157

removed call to java/lang/IllegalArgumentException::<init> : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testSetAndGetValue(fi.helsinki.cs.titokone.SettingsTest)

159

removed call to java/util/HashMap::put : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

175

removed call to java/util/HashMap::get : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

replaced return of integer sized value with (x == 0 ? 1 : 0) : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/Integer::intValue : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

188

removed call to java/util/HashMap::get : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

mutated return of Object value for fi/helsinki/cs/titokone/Settings::getStrValue to ( if (x != null) null else throw new RuntimeException ) : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

195

Substituted 0 with 1 : SURVIVED

removed call to java/util/Set::toArray : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/util/HashMap::keySet : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

mutated return of Object value for fi/helsinki/cs/titokone/Settings::getKeys to ( if (x != null) null else throw new RuntimeException ) : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

Substituted 0 with 1 : SURVIVED

208

removed call to java/util/HashMap::keySet : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/util/Set::iterator : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

209

removed call to java/lang/StringBuffer::<init> : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

210

removed call to java/util/Iterator::hasNext : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

negated conditional : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

211

removed call to java/util/Iterator::next : TIMED_OUT

212

removed call to java/util/HashMap::get : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

214

removed call to java/util/HashMap::get : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

216

removed call to java/lang/Integer::intValue : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/StringBuilder::<init> : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/StringBuilder::toString : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/StringBuilder::append : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/StringBuilder::append : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

218

removed call to java/lang/StringBuilder::toString : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/StringBuilder::append : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/StringBuilder::append : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/StringBuilder::append : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/StringBuilder::append : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/System::getProperty : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/StringBuilder::append : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/StringBuilder::<init> : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/StringBuffer::append : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/StringBuilder::append : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

222

mutated return of Object value for fi/helsinki/cs/titokone/Settings::toString to ( if (x != null) null else throw new RuntimeException ) : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/StringBuffer::toString : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

237

Substituted 2 with 3 : SURVIVED

Substituted 2 with 3 : SURVIVED

244

removed call to java/lang/System::getProperty : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/StringBuilder::append : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/StringBuilder::<init> : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/String::split : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/StringBuilder::toString : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/StringBuilder::append : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/StringBuilder::append : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

247

negated conditional : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

Substituted 0 with 1 : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

Substituted 0 with 1 : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

changed conditional boundary : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

Changed increment from 1 to -1 : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

252

negated conditional : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/String::equals : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

negated conditional : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/String::trim : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/String::startsWith : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

253

removed call to java/lang/String::split : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

257

Substituted 2 with 3 : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

negated conditional : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

Substituted 2 with 3 : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

changed conditional boundary : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

259

Substituted 0 with 1 : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

Replaced integer addition with subtraction : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

Substituted 1 with 0 : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

Substituted 0 with 1 : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/StringBuilder::append : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

Substituted 1 with 0 : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/StringBuilder::append : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/StringBuilder::toString : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/StringBuilder::<init> : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

260

Substituted 1 with 0 : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

Substituted 1 with 0 : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

261

removed call to fi/helsinki/cs/titokone/Message::toString : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

removed call to fi/helsinki/cs/titokone/Message::<init> : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

264

removed call to java/text/ParseException::<init> : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

Substituted 1 with 0 : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

Substituted 1 with 0 : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

Replaced integer addition with subtraction : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

266

Substituted 0 with 1 : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

Substituted 0 with 1 : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/String::trim : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

267

Substituted 1 with 0 : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

Substituted 1 with 0 : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/String::trim : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

269

removed call to fi/helsinki/cs/titokone/Settings::setValue : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/Integer::parseInt : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

271

removed call to fi/helsinki/cs/titokone/Settings::setValue : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testParse(fi.helsinki.cs.titokone.SettingsTest)

276

removed call to java/lang/StringBuilder::append : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/StringBuilder::toString : SURVIVED

removed call to java/lang/StringBuilder::append : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/StringBuilder::<init> : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

Substituted 0 with 1 : SURVIVED

Substituted 0 with 1 : SURVIVED

277

removed call to java/lang/StringBuilder::append : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/StringBuilder::toString : SURVIVED

removed call to java/lang/StringBuilder::append : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/lang/StringBuilder::<init> : KILLED -> fi.helsinki.cs.titokone.SettingsTest.testExtract(fi.helsinki.cs.titokone.SettingsTest)

removed call to java/util/HashMap::size : SURVIVED

Substituted 1 with 0 : SURVIVED

Substituted 1 with 0 : SURVIVED

Active mutators

Tests examined


Report generated by PIT 0.27