FixedFormatWriter.java

1
/*
2
 * Copyright 2004 the original author or authors.
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
package com.ancientprogramming.fixedformat4j.io.write;
17
18
import com.ancientprogramming.fixedformat4j.exception.FixedFormatIOException;
19
import com.ancientprogramming.fixedformat4j.format.FixedFormatManager;
20
21
import java.io.*;
22
import java.nio.charset.Charset;
23
import java.nio.file.Files;
24
import java.nio.file.Path;
25
import java.util.Iterator;
26
import java.util.Objects;
27
import java.util.stream.Stream;
28
29
import static java.lang.String.format;
30
31
/**
32
 * Writes {@link com.ancientprogramming.fixedformat4j.annotation.Record}-annotated objects to a
33
 * fixed-format file or stream, providing write-side IO symmetry with {@link
34
 * com.ancientprogramming.fixedformat4j.io.read.FixedFormatReader}.
35
 *
36
 * <p>The writer owns resource management (opening, flushing, closing) and line delimiting.
37
 * Formatting of each record is delegated entirely to
38
 * {@link FixedFormatManager#export(Object)}.</p>
39
 *
40
 * <p>Instances are thread-safe: all fields are final and each {@code write} call is independent.</p>
41
 *
42
 * <p>Quick start — homogeneous list:</p>
43
 * <pre>{@code
44
 * FixedFormatWriter writer = FixedFormatWriter.builder().build();
45
 * writer.write(Path.of("out.txt"), records);
46
 * }</pre>
47
 *
48
 * <p>Quick start — lazy stream (avoids materialising all records in memory):</p>
49
 * <pre>{@code
50
 * try (Stream<MyRecord> stream = repository.findAll()) {
51
 *     writer.write(Path.of("out.txt"), stream);
52
 * }
53
 * }</pre>
54
 *
55
 * <p>Quick start — heterogeneous mixed-type list:</p>
56
 * <pre>{@code
57
 * writer.write(Path.of("out.txt"), List.of(header, detail1, detail2, footer));
58
 * }</pre>
59
 *
60
 * @author Jacob von Eyben - <a href="https://eybenconsult.com">https://eybenconsult.com</a>
61
 * @since 1.9.0
62
 */
63
public final class FixedFormatWriter {
64
65
  private final FixedFormatManager manager;
66
  private final String lineSeparator;
67
  private final Charset defaultCharset;
68
69
  FixedFormatWriter(FixedFormatWriterBuilder builder) {
70 1 1. <init> : Removed assignment to member variable manager → KILLED
    this.manager = builder.manager;
71 1 1. <init> : Removed assignment to member variable lineSeparator → KILLED
    this.lineSeparator = builder.lineSeparator;
72 1 1. <init> : Removed assignment to member variable defaultCharset → KILLED
    this.defaultCharset = builder.charset;
73
  }
74
75
  // --- Iterable overloads ---
76
77
  /**
78
   * Writes all records from {@code records} to {@code writer}, appending
79
   * {@link FixedFormatWriterBuilder#lineSeparator(String)} after each one.
80
   *
81
   * <p>The writer is closed when this method returns, even if an exception is thrown.</p>
82
   *
83
   * @param writer  the write target; closed when this method returns
84
   * @param records the records to write; each element must be annotated with
85
   *                {@link com.ancientprogramming.fixedformat4j.annotation.Record}
86
   * @throws NullPointerException   if {@code writer} or {@code records} is {@code null}
87
   * @throws FixedFormatIOException if an IO error occurs while writing or closing
88
   * @throws com.ancientprogramming.fixedformat4j.exception.FixedFormatException if any element
89
   *         in {@code records} is not annotated with {@code @Record}
90
   */
91
  public void write(Writer writer, Iterable<?> records) {
92 2 1. write : removed call to java/util/Objects::requireNonNull → SURVIVED
2. write : replaced call to java/util/Objects::requireNonNull with argument → SURVIVED
    Objects.requireNonNull(writer, "writer must not be null");
93 2 1. write : replaced call to java/util/Objects::requireNonNull with argument → SURVIVED
2. write : removed call to java/util/Objects::requireNonNull → SURVIVED
    Objects.requireNonNull(records, "records must not be null");
94 3 1. write : removed call to com/ancientprogramming/fixedformat4j/io/write/FixedFormatWriter::writeAndClose → KILLED
2. write : removed call to com/ancientprogramming/fixedformat4j/io/write/FixedFormatWriter::toBuffered → KILLED
3. write : removed call to java/lang/Iterable::iterator → KILLED
    writeAndClose(toBuffered(writer), records.iterator());
95
  }
96
97
  /**
98
   * Writes all records from {@code records} to {@code out} using the default charset.
99
   *
100
   * @param out     the output stream; closed when this method returns
101
   * @param records the records to write; each element must be annotated with
102
   *                {@link com.ancientprogramming.fixedformat4j.annotation.Record}
103
   * @throws NullPointerException   if {@code out} or {@code records} is {@code null}
104
   * @throws FixedFormatIOException if an IO error occurs while writing or closing
105
   * @throws com.ancientprogramming.fixedformat4j.exception.FixedFormatException if any element
106
   *         in {@code records} is not annotated with {@code @Record}
107
   */
108
  public void write(OutputStream out, Iterable<?> records) {
109 1 1. write : removed call to com/ancientprogramming/fixedformat4j/io/write/FixedFormatWriter::write → KILLED
    write(out, defaultCharset, records);
110
  }
111
112
  /**
113
   * Writes all records from {@code records} to {@code out} using {@code charset}.
114
   *
115
   * @param out     the output stream; closed when this method returns
116
   * @param charset the character encoding to apply
117
   * @param records the records to write; each element must be annotated with
118
   *                {@link com.ancientprogramming.fixedformat4j.annotation.Record}
119
   * @throws NullPointerException   if {@code out}, {@code charset}, or {@code records} is
120
   *                                {@code null}
121
   * @throws FixedFormatIOException if an IO error occurs while writing or closing
122
   * @throws com.ancientprogramming.fixedformat4j.exception.FixedFormatException if any element
123
   *         in {@code records} is not annotated with {@code @Record}
124
   */
125
  public void write(OutputStream out, Charset charset, Iterable<?> records) {
126 2 1. write : replaced call to java/util/Objects::requireNonNull with argument → SURVIVED
2. write : removed call to java/util/Objects::requireNonNull → SURVIVED
    Objects.requireNonNull(records, "records must not be null");
127 2 1. write : removed call to com/ancientprogramming/fixedformat4j/io/write/FixedFormatWriter::openWriter → KILLED
2. write : removed call to com/ancientprogramming/fixedformat4j/io/write/FixedFormatWriter::write → KILLED
    write(openWriter(out, charset), records);
128
  }
129
130
  /**
131
   * Writes all records from {@code records} to {@code path} using the default charset,
132
   * truncating any existing file.
133
   *
134
   * @param path    the path to write to; created or truncated
135
   * @param records the records to write; each element must be annotated with
136
   *                {@link com.ancientprogramming.fixedformat4j.annotation.Record}
137
   * @throws NullPointerException   if {@code path} or {@code records} is {@code null}
138
   * @throws FixedFormatIOException if the path cannot be opened or an IO error occurs
139
   * @throws com.ancientprogramming.fixedformat4j.exception.FixedFormatException if any element
140
   *         in {@code records} is not annotated with {@code @Record}
141
   */
142
  public void write(Path path, Iterable<?> records) {
143 1 1. write : removed call to com/ancientprogramming/fixedformat4j/io/write/FixedFormatWriter::write → KILLED
    write(path, defaultCharset, records);
144
  }
145
146
  /**
147
   * Writes all records from {@code records} to {@code path} using {@code charset},
148
   * truncating any existing file.
149
   *
150
   * @param path    the path to write to; created or truncated
151
   * @param charset the character encoding to apply
152
   * @param records the records to write; each element must be annotated with
153
   *                {@link com.ancientprogramming.fixedformat4j.annotation.Record}
154
   * @throws NullPointerException   if {@code path}, {@code charset}, or {@code records} is
155
   *                                {@code null}
156
   * @throws FixedFormatIOException if the path cannot be opened or an IO error occurs
157
   * @throws com.ancientprogramming.fixedformat4j.exception.FixedFormatException if any element
158
   *         in {@code records} is not annotated with {@code @Record}
159
   */
160
  public void write(Path path, Charset charset, Iterable<?> records) {
161 2 1. write : removed call to java/util/Objects::requireNonNull → SURVIVED
2. write : replaced call to java/util/Objects::requireNonNull with argument → SURVIVED
    Objects.requireNonNull(records, "records must not be null");
162 2 1. write : removed call to com/ancientprogramming/fixedformat4j/io/write/FixedFormatWriter::write → KILLED
2. write : removed call to com/ancientprogramming/fixedformat4j/io/write/FixedFormatWriter::openWriter → KILLED
    write(openWriter(path, charset), records);
163
  }
164
165
  // --- Stream overloads ---
166
167
  /**
168
   * Writes all records from {@code records} to {@code writer}.
169
   *
170
   * <p>The stream is consumed but <em>not closed</em> — the caller retains ownership of
171
   * the stream lifecycle. The writer is closed when this method returns.</p>
172
   *
173
   * @param writer  the write target; closed when this method returns
174
   * @param records a stream of records to write; each element must be annotated with
175
   *                {@link com.ancientprogramming.fixedformat4j.annotation.Record}; consumed but
176
   *                not closed
177
   * @throws NullPointerException   if {@code writer} or {@code records} is {@code null}
178
   * @throws FixedFormatIOException if an IO error occurs while writing or closing
179
   * @throws com.ancientprogramming.fixedformat4j.exception.FixedFormatException if any element
180
   *         in {@code records} is not annotated with {@code @Record}
181
   */
182
  public void write(Writer writer, Stream<?> records) {
183 2 1. write : replaced call to java/util/Objects::requireNonNull with argument → SURVIVED
2. write : removed call to java/util/Objects::requireNonNull → SURVIVED
    Objects.requireNonNull(writer, "writer must not be null");
184 2 1. write : removed call to java/util/Objects::requireNonNull → SURVIVED
2. write : replaced call to java/util/Objects::requireNonNull with argument → SURVIVED
    Objects.requireNonNull(records, "records must not be null");
185 3 1. write : removed call to com/ancientprogramming/fixedformat4j/io/write/FixedFormatWriter::writeAndClose → KILLED
2. write : removed call to com/ancientprogramming/fixedformat4j/io/write/FixedFormatWriter::toBuffered → KILLED
3. write : removed call to java/util/stream/Stream::iterator → KILLED
    writeAndClose(toBuffered(writer), records.iterator());
186
  }
187
188
  /**
189
   * Writes all records from {@code records} to {@code out} using the default charset.
190
   *
191
   * <p>The stream is consumed but not closed. The output stream is closed when this method
192
   * returns.</p>
193
   *
194
   * @param out     the output stream; closed when this method returns
195
   * @param records a stream of records to write; each element must be annotated with
196
   *                {@link com.ancientprogramming.fixedformat4j.annotation.Record}; consumed but
197
   *                not closed
198
   * @throws NullPointerException   if {@code out} or {@code records} is {@code null}
199
   * @throws FixedFormatIOException if an IO error occurs while writing or closing
200
   * @throws com.ancientprogramming.fixedformat4j.exception.FixedFormatException if any element
201
   *         in {@code records} is not annotated with {@code @Record}
202
   */
203
  public void write(OutputStream out, Stream<?> records) {
204 1 1. write : removed call to com/ancientprogramming/fixedformat4j/io/write/FixedFormatWriter::write → KILLED
    write(out, defaultCharset, records);
205
  }
206
207
  /**
208
   * Writes all records from {@code records} to {@code out} using {@code charset}.
209
   *
210
   * <p>The stream is consumed but not closed. The output stream is closed when this method
211
   * returns.</p>
212
   *
213
   * @param out     the output stream; closed when this method returns
214
   * @param charset the character encoding to apply
215
   * @param records a stream of records to write; each element must be annotated with
216
   *                {@link com.ancientprogramming.fixedformat4j.annotation.Record}; consumed but
217
   *                not closed
218
   * @throws NullPointerException   if {@code out}, {@code charset}, or {@code records} is
219
   *                                {@code null}
220
   * @throws FixedFormatIOException if an IO error occurs while writing or closing
221
   * @throws com.ancientprogramming.fixedformat4j.exception.FixedFormatException if any element
222
   *         in {@code records} is not annotated with {@code @Record}
223
   */
224
  public void write(OutputStream out, Charset charset, Stream<?> records) {
225 2 1. write : removed call to java/util/Objects::requireNonNull → SURVIVED
2. write : replaced call to java/util/Objects::requireNonNull with argument → SURVIVED
    Objects.requireNonNull(records, "records must not be null");
226 2 1. write : removed call to com/ancientprogramming/fixedformat4j/io/write/FixedFormatWriter::write → KILLED
2. write : removed call to com/ancientprogramming/fixedformat4j/io/write/FixedFormatWriter::openWriter → KILLED
    write(openWriter(out, charset), records);
227
  }
228
229
  /**
230
   * Writes all records from {@code records} to {@code path} using the default charset,
231
   * truncating any existing file.
232
   *
233
   * <p>The stream is consumed but not closed.</p>
234
   *
235
   * @param path    the path to write to; created or truncated
236
   * @param records a stream of records to write; each element must be annotated with
237
   *                {@link com.ancientprogramming.fixedformat4j.annotation.Record}; consumed but
238
   *                not closed
239
   * @throws NullPointerException   if {@code path} or {@code records} is {@code null}
240
   * @throws FixedFormatIOException if the path cannot be opened or an IO error occurs
241
   * @throws com.ancientprogramming.fixedformat4j.exception.FixedFormatException if any element
242
   *         in {@code records} is not annotated with {@code @Record}
243
   */
244
  public void write(Path path, Stream<?> records) {
245 1 1. write : removed call to com/ancientprogramming/fixedformat4j/io/write/FixedFormatWriter::write → KILLED
    write(path, defaultCharset, records);
246
  }
247
248
  /**
249
   * Writes all records from {@code records} to {@code path} using {@code charset},
250
   * truncating any existing file.
251
   *
252
   * <p>The stream is consumed but not closed.</p>
253
   *
254
   * @param path    the path to write to; created or truncated
255
   * @param charset the character encoding to apply
256
   * @param records a stream of records to write; each element must be annotated with
257
   *                {@link com.ancientprogramming.fixedformat4j.annotation.Record}; consumed but
258
   *                not closed
259
   * @throws NullPointerException   if {@code path}, {@code charset}, or {@code records} is
260
   *                                {@code null}
261
   * @throws FixedFormatIOException if the path cannot be opened or an IO error occurs
262
   * @throws com.ancientprogramming.fixedformat4j.exception.FixedFormatException if any element
263
   *         in {@code records} is not annotated with {@code @Record}
264
   */
265
  public void write(Path path, Charset charset, Stream<?> records) {
266 2 1. write : replaced call to java/util/Objects::requireNonNull with argument → SURVIVED
2. write : removed call to java/util/Objects::requireNonNull → SURVIVED
    Objects.requireNonNull(records, "records must not be null");
267 2 1. write : removed call to com/ancientprogramming/fixedformat4j/io/write/FixedFormatWriter::openWriter → KILLED
2. write : removed call to com/ancientprogramming/fixedformat4j/io/write/FixedFormatWriter::write → KILLED
    write(openWriter(path, charset), records);
268
  }
269
270
  // --- Factory ---
271
272
  /**
273
   * Returns a new builder for constructing a {@link FixedFormatWriter}.
274
   *
275
   * @return a fresh builder instance
276
   */
277
  public static FixedFormatWriterBuilder builder() {
278 2 1. builder : replaced return value with null for com/ancientprogramming/fixedformat4j/io/write/FixedFormatWriter::builder → KILLED
2. builder : removed call to com/ancientprogramming/fixedformat4j/io/write/FixedFormatWriterBuilder::<init> → KILLED
    return new FixedFormatWriterBuilder();
279
  }
280
281
  // --- Internal ---
282
283
  private void writeAndClose(BufferedWriter bw, Iterator<?> records) {
284
    try (bw) {
285 4 1. writeAndClose : removed conditional - replaced equality check with true → KILLED
2. writeAndClose : removed conditional - replaced equality check with false → KILLED
3. writeAndClose : negated conditional → KILLED
4. writeAndClose : removed call to java/util/Iterator::hasNext → KILLED
      while (records.hasNext()) {
286 3 1. writeAndClose : removed call to java/io/BufferedWriter::write → KILLED
2. writeAndClose : removed call to java/util/Iterator::next → KILLED
3. writeAndClose : removed call to com/ancientprogramming/fixedformat4j/format/FixedFormatManager::export → KILLED
        bw.write(manager.export(records.next()));
287 1 1. writeAndClose : removed call to java/io/BufferedWriter::write → KILLED
        bw.write(lineSeparator);
288
      }
289
    } catch (IOException e) {
290 1 1. writeAndClose : removed call to com/ancientprogramming/fixedformat4j/exception/FixedFormatIOException::<init> → KILLED
      throw new FixedFormatIOException("IO error writing or closing fixed-format output", e);
291
    }
292
  }
293
294
  private static BufferedWriter toBuffered(Writer writer) {
295 5 1. toBuffered : removed conditional - replaced equality check with false → SURVIVED
2. toBuffered : removed call to java/io/BufferedWriter::<init> → KILLED
3. toBuffered : negated conditional → KILLED
4. toBuffered : replaced return value with null for com/ancientprogramming/fixedformat4j/io/write/FixedFormatWriter::toBuffered → KILLED
5. toBuffered : removed conditional - replaced equality check with true → KILLED
    return writer instanceof BufferedWriter ? (BufferedWriter) writer : new BufferedWriter(writer);
296
  }
297
298
  private static OutputStreamWriter openWriter(OutputStream out, Charset charset) {
299 2 1. openWriter : removed call to java/util/Objects::requireNonNull → SURVIVED
2. openWriter : replaced call to java/util/Objects::requireNonNull with argument → SURVIVED
    Objects.requireNonNull(out,     "out must not be null");
300 2 1. openWriter : replaced call to java/util/Objects::requireNonNull with argument → SURVIVED
2. openWriter : removed call to java/util/Objects::requireNonNull → SURVIVED
    Objects.requireNonNull(charset, "charset must not be null");
301 2 1. openWriter : removed call to java/io/OutputStreamWriter::<init> → KILLED
2. openWriter : replaced return value with null for com/ancientprogramming/fixedformat4j/io/write/FixedFormatWriter::openWriter → KILLED
    return new OutputStreamWriter(out, charset);
302
  }
303
304
  private static BufferedWriter openWriter(Path path, Charset charset) {
305 2 1. openWriter : removed call to java/util/Objects::requireNonNull → SURVIVED
2. openWriter : replaced call to java/util/Objects::requireNonNull with argument → SURVIVED
    Objects.requireNonNull(path,    "path must not be null");
306 2 1. openWriter : removed call to java/util/Objects::requireNonNull → SURVIVED
2. openWriter : replaced call to java/util/Objects::requireNonNull with argument → SURVIVED
    Objects.requireNonNull(charset, "charset must not be null");
307
    try {
308 3 1. openWriter : Substituted 0 with 1 → KILLED
2. openWriter : replaced return value with null for com/ancientprogramming/fixedformat4j/io/write/FixedFormatWriter::openWriter → KILLED
3. openWriter : removed call to java/nio/file/Files::newBufferedWriter → KILLED
      return Files.newBufferedWriter(path, charset);
309
    } catch (IOException e) {
310 5 1. openWriter : replaced call to java/lang/String::format with argument → SURVIVED
2. openWriter : removed call to java/lang/String::format → SURVIVED
3. openWriter : Substituted 1 with 0 → KILLED
4. openWriter : Substituted 0 with 1 → KILLED
5. openWriter : removed call to com/ancientprogramming/fixedformat4j/exception/FixedFormatIOException::<init> → KILLED
      throw new FixedFormatIOException(format("Cannot open path: %s", path), e);
311
    }
312
  }
313
}

Mutations

70

1.1
Location : <init>
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterBuilder.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterBuilder]/[method:customManagerIsUsedWhenWriting()]
Removed assignment to member variable manager → KILLED

71

1.1
Location : <init>
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterBuilder.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterBuilder]/[method:customManagerIsUsedWhenWriting()]
Removed assignment to member variable lineSeparator → KILLED

72

1.1
Location : <init>
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterBuilder.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterBuilder]/[method:customCharsetIsAppliedWhenWritingToOutputStream()]
Removed assignment to member variable defaultCharset → KILLED

92

1.1
Location : write
Killed by : none
removed call to java/util/Objects::requireNonNull → SURVIVED
Covering tests

2.2
Location : write
Killed by : none
replaced call to java/util/Objects::requireNonNull with argument → SURVIVED Covering tests

93

1.1
Location : write
Killed by : none
replaced call to java/util/Objects::requireNonNull with argument → SURVIVED
Covering tests

2.2
Location : write
Killed by : none
removed call to java/util/Objects::requireNonNull → SURVIVED Covering tests

94

1.1
Location : write
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterInputShapes.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterInputShapes]/[method:throwsFixedFormatExceptionForNonAnnotatedRecord()]
removed call to com/ancientprogramming/fixedformat4j/io/write/FixedFormatWriter::writeAndClose → KILLED

2.2
Location : write
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterInputShapes.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterInputShapes]/[method:singleRecord()]
removed call to com/ancientprogramming/fixedformat4j/io/write/FixedFormatWriter::toBuffered → KILLED

3.3
Location : write
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterInputShapes.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterInputShapes]/[method:writesEmptyIterable()]
removed call to java/lang/Iterable::iterator → KILLED

109

1.1
Location : write
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets]/[method:throwsNullPointerWhenIterableRecordsIsNullForOutputStream()]
removed call to com/ancientprogramming/fixedformat4j/io/write/FixedFormatWriter::write → KILLED

126

1.1
Location : write
Killed by : none
replaced call to java/util/Objects::requireNonNull with argument → SURVIVED
Covering tests

2.2
Location : write
Killed by : none
removed call to java/util/Objects::requireNonNull → SURVIVED Covering tests

127

1.1
Location : write
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets]/[method:writesToOutputStream()]
removed call to com/ancientprogramming/fixedformat4j/io/write/FixedFormatWriter::openWriter → KILLED

2.2
Location : write
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets]/[method:writesToOutputStream()]
removed call to com/ancientprogramming/fixedformat4j/io/write/FixedFormatWriter::write → KILLED

143

1.1
Location : write
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets]/[method:throwsNullPointerWhenIterableRecordsIsNullForPath(java.nio.file.Path)]
removed call to com/ancientprogramming/fixedformat4j/io/write/FixedFormatWriter::write → KILLED

161

1.1
Location : write
Killed by : none
removed call to java/util/Objects::requireNonNull → SURVIVED
Covering tests

2.2
Location : write
Killed by : none
replaced call to java/util/Objects::requireNonNull with argument → SURVIVED Covering tests

162

1.1
Location : write
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets]/[method:writingToPathTruncatesExistingFile(java.nio.file.Path)]
removed call to com/ancientprogramming/fixedformat4j/io/write/FixedFormatWriter::write → KILLED

2.2
Location : write
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets]/[method:wrapsIoExceptionWhenPathCannotBeOpenedForIterable(java.nio.file.Path)]
removed call to com/ancientprogramming/fixedformat4j/io/write/FixedFormatWriter::openWriter → KILLED

183

1.1
Location : write
Killed by : none
replaced call to java/util/Objects::requireNonNull with argument → SURVIVED
Covering tests

2.2
Location : write
Killed by : none
removed call to java/util/Objects::requireNonNull → SURVIVED Covering tests

184

1.1
Location : write
Killed by : none
removed call to java/util/Objects::requireNonNull → SURVIVED
Covering tests

2.2
Location : write
Killed by : none
replaced call to java/util/Objects::requireNonNull with argument → SURVIVED Covering tests

185

1.1
Location : write
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets]/[method:writesToOutputStreamWithExplicitCharsetStream()]
removed call to com/ancientprogramming/fixedformat4j/io/write/FixedFormatWriter::writeAndClose → KILLED

2.2
Location : write
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets]/[method:writesToOutputStreamWithExplicitCharsetStream()]
removed call to com/ancientprogramming/fixedformat4j/io/write/FixedFormatWriter::toBuffered → KILLED

3.3
Location : write
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterInputShapes.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterInputShapes]/[method:writesEmptyStream()]
removed call to java/util/stream/Stream::iterator → KILLED

204

1.1
Location : write
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets]/[method:throwsNullPointerWhenStreamRecordsIsNullForOutputStream()]
removed call to com/ancientprogramming/fixedformat4j/io/write/FixedFormatWriter::write → KILLED

225

1.1
Location : write
Killed by : none
removed call to java/util/Objects::requireNonNull → SURVIVED
Covering tests

2.2
Location : write
Killed by : none
replaced call to java/util/Objects::requireNonNull with argument → SURVIVED Covering tests

226

1.1
Location : write
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets]/[method:writesToOutputStreamWithExplicitCharsetStream()]
removed call to com/ancientprogramming/fixedformat4j/io/write/FixedFormatWriter::write → KILLED

2.2
Location : write
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets]/[method:writesToOutputStreamWithExplicitCharsetStream()]
removed call to com/ancientprogramming/fixedformat4j/io/write/FixedFormatWriter::openWriter → KILLED

245

1.1
Location : write
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets]/[method:throwsNullPointerWhenStreamRecordsIsNullForPath(java.nio.file.Path)]
removed call to com/ancientprogramming/fixedformat4j/io/write/FixedFormatWriter::write → KILLED

266

1.1
Location : write
Killed by : none
replaced call to java/util/Objects::requireNonNull with argument → SURVIVED
Covering tests

2.2
Location : write
Killed by : none
removed call to java/util/Objects::requireNonNull → SURVIVED Covering tests

267

1.1
Location : write
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets]/[method:wrapsIoExceptionWhenPathCannotBeOpenedForStream(java.nio.file.Path)]
removed call to com/ancientprogramming/fixedformat4j/io/write/FixedFormatWriter::openWriter → KILLED

2.2
Location : write
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets]/[method:writesToPathWithExplicitCharsetStream(java.nio.file.Path)]
removed call to com/ancientprogramming/fixedformat4j/io/write/FixedFormatWriter::write → KILLED

278

1.1
Location : builder
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterBuilder.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterBuilder]/[method:buildsWithNoOptions()]
replaced return value with null for com/ancientprogramming/fixedformat4j/io/write/FixedFormatWriter::builder → KILLED

2.2
Location : builder
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterBuilder.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterBuilder]/[method:buildsWithNoOptions()]
removed call to com/ancientprogramming/fixedformat4j/io/write/FixedFormatWriterBuilder::<init> → KILLED

285

1.1
Location : writeAndClose
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterInputShapes.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterInputShapes]/[method:writesEmptyStream()]
removed conditional - replaced equality check with true → KILLED

2.2
Location : writeAndClose
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterInputShapes.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterInputShapes]/[method:throwsFixedFormatExceptionForNonAnnotatedRecord()]
removed conditional - replaced equality check with false → KILLED

3.3
Location : writeAndClose
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterInputShapes.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterInputShapes]/[method:writesEmptyStream()]
negated conditional → KILLED

4.4
Location : writeAndClose
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterInputShapes.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterInputShapes]/[method:throwsFixedFormatExceptionForNonAnnotatedRecord()]
removed call to java/util/Iterator::hasNext → KILLED

286

1.1
Location : writeAndClose
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterInputShapes.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterInputShapes]/[method:singleRecord()]
removed call to java/io/BufferedWriter::write → KILLED

2.2
Location : writeAndClose
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterInputShapes.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterInputShapes]/[method:throwsFixedFormatExceptionForNonAnnotatedRecord()]
removed call to java/util/Iterator::next → KILLED

3.3
Location : writeAndClose
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterInputShapes.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterInputShapes]/[method:throwsFixedFormatExceptionForNonAnnotatedRecord()]
removed call to com/ancientprogramming/fixedformat4j/format/FixedFormatManager::export → KILLED

287

1.1
Location : writeAndClose
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterInputShapes.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterInputShapes]/[method:singleRecord()]
removed call to java/io/BufferedWriter::write → KILLED

290

1.1
Location : writeAndClose
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets]/[method:wrapsIoExceptionInFixedFormatIOException()]
removed call to com/ancientprogramming/fixedformat4j/exception/FixedFormatIOException::<init> → KILLED

295

1.1
Location : toBuffered
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterInputShapes.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterInputShapes]/[method:singleRecord()]
removed call to java/io/BufferedWriter::<init> → KILLED

2.2
Location : toBuffered
Killed by : none
removed conditional - replaced equality check with false → SURVIVED
Covering tests

3.3
Location : toBuffered
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterInputShapes.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterInputShapes]/[method:writesEmptyStream()]
negated conditional → KILLED

4.4
Location : toBuffered
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterInputShapes.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterInputShapes]/[method:writesList()]
replaced return value with null for com/ancientprogramming/fixedformat4j/io/write/FixedFormatWriter::toBuffered → KILLED

5.5
Location : toBuffered
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterInputShapes.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterInputShapes]/[method:writesEmptyStream()]
removed conditional - replaced equality check with true → KILLED

299

1.1
Location : openWriter
Killed by : none
removed call to java/util/Objects::requireNonNull → SURVIVED
Covering tests

2.2
Location : openWriter
Killed by : none
replaced call to java/util/Objects::requireNonNull with argument → SURVIVED Covering tests

300

1.1
Location : openWriter
Killed by : none
replaced call to java/util/Objects::requireNonNull with argument → SURVIVED
Covering tests

2.2
Location : openWriter
Killed by : none
removed call to java/util/Objects::requireNonNull → SURVIVED Covering tests

301

1.1
Location : openWriter
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets]/[method:writesToOutputStreamWithExplicitCharsetStream()]
removed call to java/io/OutputStreamWriter::<init> → KILLED

2.2
Location : openWriter
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets]/[method:writesToOutputStreamWithExplicitCharsetStream()]
replaced return value with null for com/ancientprogramming/fixedformat4j/io/write/FixedFormatWriter::openWriter → KILLED

305

1.1
Location : openWriter
Killed by : none
removed call to java/util/Objects::requireNonNull → SURVIVED
Covering tests

2.2
Location : openWriter
Killed by : none
replaced call to java/util/Objects::requireNonNull with argument → SURVIVED Covering tests

306

1.1
Location : openWriter
Killed by : none
removed call to java/util/Objects::requireNonNull → SURVIVED
Covering tests

2.2
Location : openWriter
Killed by : none
replaced call to java/util/Objects::requireNonNull with argument → SURVIVED Covering tests

308

1.1
Location : openWriter
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets]/[method:wrapsIoExceptionWhenPathCannotBeOpenedForStream(java.nio.file.Path)]
Substituted 0 with 1 → KILLED

2.2
Location : openWriter
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets]/[method:writingToPathTruncatesExistingFile(java.nio.file.Path)]
replaced return value with null for com/ancientprogramming/fixedformat4j/io/write/FixedFormatWriter::openWriter → KILLED

3.3
Location : openWriter
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets]/[method:wrapsIoExceptionWhenPathCannotBeOpenedForStream(java.nio.file.Path)]
removed call to java/nio/file/Files::newBufferedWriter → KILLED

310

1.1
Location : openWriter
Killed by : none
replaced call to java/lang/String::format with argument → SURVIVED
Covering tests

2.2
Location : openWriter
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets]/[method:wrapsIoExceptionWhenPathCannotBeOpenedForStream(java.nio.file.Path)]
Substituted 1 with 0 → KILLED

3.3
Location : openWriter
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets]/[method:wrapsIoExceptionWhenPathCannotBeOpenedForStream(java.nio.file.Path)]
Substituted 0 with 1 → KILLED

4.4
Location : openWriter
Killed by : com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.io.TestFixedFormatWriterOutputTargets]/[method:wrapsIoExceptionWhenPathCannotBeOpenedForStream(java.nio.file.Path)]
removed call to com/ancientprogramming/fixedformat4j/exception/FixedFormatIOException::<init> → KILLED

5.5
Location : openWriter
Killed by : none
removed call to java/lang/String::format → SURVIVED Covering tests

Active mutators

Tests examined


Report generated by PIT 1.23.1 support