TeamCsvService.java

1
package edu.ucsb.cs156.frontiers.services;
2
3
import edu.ucsb.cs156.frontiers.entities.RosterStudent;
4
import edu.ucsb.cs156.frontiers.models.NameAndTeam;
5
import java.io.IOException;
6
import java.io.Writer;
7
import java.util.ArrayList;
8
import java.util.Comparator;
9
import java.util.HashMap;
10
import java.util.List;
11
import java.util.Map;
12
import java.util.TreeMap;
13
import org.apache.commons.csv.CSVFormat;
14
import org.apache.commons.csv.CSVPrinter;
15
import org.springframework.stereotype.Service;
16
17
/**
18
 * Builds the compact team tables that instructors traditionally produce by hand: every student's
19
 * name abbreviated as far as it can be while staying unique, laid out in several side-by-side
20
 * column pairs (e.g. "Name,Team,,Name,Team"). The name abbreviation, the column balancing and the
21
 * CSV writing are separate steps so that different tables (name to team, team to names) can share
22
 * them.
23
 */
24
@Service
25
public class TeamCsvService {
26
27
  /**
28
   * How many students are listed in each "Name,Team" column of the "by name" table in the formatted
29
   * teams CSV ({@link #writeFormattedTeamsCsv(Writer, List)}).
30
   */
31
  public static final int NAMES_PER_COLUMN = 24;
32
33
  /**
34
   * How many teams are listed in each "Team,Name" column of the "by team" table in the formatted
35
   * teams CSV ({@link #writeFormattedTeamsCsv(Writer, List)}).
36
   */
37
  public static final int TEAMS_PER_COLUMN = 4;
38
39
  /**
40
   * Converts a name to Title Case: the first letter of each word is upper case and the rest lower
41
   * case. A new word starts after any non-letter character, so hyphenated names and names with
42
   * apostrophes are handled (e.g. "MARY-JANE O'BRIEN" becomes "Mary-Jane O'Brien"). Leading and
43
   * trailing whitespace is removed; null becomes "".
44
   *
45
   * @param name the raw name (may be null)
46
   * @return the name in Title Case
47
   */
48
  public String titleCase(String name) {
49 1 1. titleCase : negated conditional → KILLED
    if (name == null) {
50
      return "";
51
    }
52
    String trimmed = name.trim();
53
    StringBuilder result = new StringBuilder(trimmed.length());
54
    boolean startOfWord = true;
55
    for (char c : trimmed.toCharArray()) {
56 1 1. titleCase : negated conditional → KILLED
      if (Character.isLetter(c)) {
57 1 1. titleCase : negated conditional → KILLED
        result.append(startOfWord ? Character.toUpperCase(c) : Character.toLowerCase(c));
58
        startOfWord = false;
59
      } else {
60
        result.append(c);
61
        startOfWord = true;
62
      }
63
    }
64 1 1. titleCase : replaced return value with "" for edu/ucsb/cs156/frontiers/services/TeamCsvService::titleCase → KILLED
    return result.toString();
65
  }
66
67
  /**
68
   * Returns the first word of the given name: everything before the first whitespace, once leading
69
   * and trailing whitespace has been removed. The roster's first name field often holds a first and
70
   * a middle name ("Chris Edward"); we assume the first space marks the end of the first name. Null
71
   * becomes "".
72
   *
73
   * @param name the raw name (may be null)
74
   * @return the first word of the name
75
   */
76
  public String firstWord(String name) {
77 1 1. firstWord : negated conditional → KILLED
    if (name == null) {
78
      return "";
79
    }
80 1 1. firstWord : replaced return value with "" for edu/ucsb/cs156/frontiers/services/TeamCsvService::firstWord → KILLED
    return name.trim().split("\\s+", 2)[0];
81
  }
82
83
  /**
84
   * Computes the abbreviated name and team for each student, preserving the order of the input
85
   * list. The first name is the first word of the roster's first name field (see {@link
86
   * #firstWord}), so a middle name in that field is ignored. Each name is abbreviated as far as
87
   * possible while remaining unique among all students:
88
   *
89
   * <ul>
90
   *   <li>first name only, where no other student shares that first name;
91
   *   <li>first name plus last initial, where that is enough to be unambiguous;
92
   *   <li>first name plus full last name, otherwise;
93
   *   <li>first name plus full last name followed by an asterisk, when another student has exactly
94
   *       the same first and last name (the instructor can then disambiguate by hand).
95
   * </ul>
96
   *
97
   * The team is the first of the student's teams, or "" if the student has no team.
98
   *
99
   * @param students the roster students, already in the desired order
100
   * @return one NameAndTeam per student, in the same order
101
   */
102
  public List<NameAndTeam> nameAndTeams(List<RosterStudent> students) {
103
    List<String> firsts = new ArrayList<>();
104
    List<String> withInitials = new ArrayList<>();
105
    List<String> fulls = new ArrayList<>();
106
    for (RosterStudent student : students) {
107
      String first = titleCase(firstWord(student.getFirstName()));
108
      String last = titleCase(student.getLastName());
109
      firsts.add(first);
110 1 1. nameAndTeams : negated conditional → KILLED
      withInitials.add(join(first, last.isEmpty() ? "" : last.substring(0, 1)));
111
      fulls.add(join(first, last));
112
    }
113
114
    Map<String, Integer> firstCounts = counts(firsts);
115
    Map<String, Integer> withInitialCounts = counts(withInitials);
116
    Map<String, Integer> fullCounts = counts(fulls);
117
118
    List<NameAndTeam> result = new ArrayList<>();
119 2 1. nameAndTeams : negated conditional → KILLED
2. nameAndTeams : changed conditional boundary → KILLED
    for (int i = 0; i < students.size(); i++) {
120
      String name;
121 1 1. nameAndTeams : negated conditional → KILLED
      if (firstCounts.get(firsts.get(i)) == 1) {
122
        name = firsts.get(i);
123 1 1. nameAndTeams : negated conditional → KILLED
      } else if (withInitialCounts.get(withInitials.get(i)) == 1) {
124
        name = withInitials.get(i);
125 1 1. nameAndTeams : negated conditional → KILLED
      } else if (fullCounts.get(fulls.get(i)) == 1) {
126
        name = fulls.get(i);
127
      } else {
128
        name = fulls.get(i) + "*";
129
      }
130
      List<String> teams = students.get(i).getTeams();
131 1 1. nameAndTeams : negated conditional → KILLED
      String team = teams.isEmpty() ? "" : teams.get(0);
132
      result.add(new NameAndTeam(name, team));
133
    }
134 1 1. nameAndTeams : replaced return value with Collections.emptyList for edu/ucsb/cs156/frontiers/services/TeamCsvService::nameAndTeams → KILLED
    return result;
135
  }
136
137
  /**
138
   * Splits the items into the given number of columns, filling column by column, with the column
139
   * lengths as balanced as possible: every column gets items.size() / columns items, and the first
140
   * items.size() % columns columns get one extra.
141
   *
142
   * @param <T> the type of item being laid out (e.g. a student, or a whole team)
143
   * @param items the items, in order
144
   * @param columns the number of columns, at least 1
145
   * @return a list of exactly {@code columns} lists, the first of which is never shorter than any
146
   *     other
147
   * @throws IllegalArgumentException if columns is less than 1
148
   */
149
  public <T> List<List<T>> layoutColumns(List<T> items, int columns) {
150 2 1. layoutColumns : negated conditional → KILLED
2. layoutColumns : changed conditional boundary → KILLED
    if (columns < 1) {
151
      throw new IllegalArgumentException("columns must be at least 1");
152
    }
153 1 1. layoutColumns : Replaced integer division with multiplication → KILLED
    int base = items.size() / columns;
154 1 1. layoutColumns : Replaced integer modulus with multiplication → KILLED
    int extra = items.size() % columns;
155
    List<List<T>> result = new ArrayList<>();
156
    int start = 0;
157 2 1. layoutColumns : negated conditional → KILLED
2. layoutColumns : changed conditional boundary → KILLED
    for (int c = 0; c < columns; c++) {
158 3 1. layoutColumns : changed conditional boundary → KILLED
2. layoutColumns : negated conditional → KILLED
3. layoutColumns : Replaced integer addition with subtraction → KILLED
      int size = base + (c < extra ? 1 : 0);
159 1 1. layoutColumns : Replaced integer addition with subtraction → KILLED
      result.add(items.subList(start, start + size));
160 1 1. layoutColumns : Replaced integer addition with subtraction → KILLED
      start += size;
161
    }
162 1 1. layoutColumns : replaced return value with Collections.emptyList for edu/ucsb/cs156/frontiers/services/TeamCsvService::layoutColumns → KILLED
    return result;
163
  }
164
165
  /**
166
   * Splits the items into columns of at most {@code perColumn} items, filling column by column:
167
   * every column except the last one is full. Unlike {@link #layoutColumns}, the number of columns
168
   * is not fixed; there are as many as needed, and always at least one (which is empty when there
169
   * are no items).
170
   *
171
   * @param <T> the type of item being laid out (e.g. a student, or a whole team)
172
   * @param items the items, in order
173
   * @param perColumn the most items in one column, at least 1
174
   * @return the columns, in order
175
   * @throws IllegalArgumentException if perColumn is less than 1
176
   */
177
  public <T> List<List<T>> chunkColumns(List<T> items, int perColumn) {
178 2 1. chunkColumns : negated conditional → TIMED_OUT
2. chunkColumns : changed conditional boundary → KILLED
    if (perColumn < 1) {
179
      throw new IllegalArgumentException("perColumn must be at least 1");
180
    }
181
    List<List<T>> result = new ArrayList<>();
182 3 1. chunkColumns : Replaced integer addition with subtraction → KILLED
2. chunkColumns : changed conditional boundary → KILLED
3. chunkColumns : negated conditional → KILLED
    for (int start = 0; start < items.size(); start += perColumn) {
183 1 1. chunkColumns : Replaced integer addition with subtraction → KILLED
      result.add(items.subList(start, Math.min(start + perColumn, items.size())));
184
    }
185 1 1. chunkColumns : negated conditional → KILLED
    if (result.isEmpty()) {
186
      result.add(List.of());
187
    }
188 1 1. chunkColumns : replaced return value with Collections.emptyList for edu/ucsb/cs156/frontiers/services/TeamCsvService::chunkColumns → KILLED
    return result;
189
  }
190
191
  /**
192
   * Writes a CSV made of several side-by-side columns separated by a blank cell. The header line
193
   * repeats {@code headerCells} once per column; then there is one line per row of the longest
194
   * column. Each column is a list of rows, and each row a list of cells with the same length as
195
   * {@code headerCells}. Rows missing from shorter columns are written as blank cells.
196
   *
197
   * @param writer where to write the CSV
198
   * @param headerCells the cells of one column's header, e.g. ["Name", "Team"]
199
   * @param columns the columns, each a list of rows of cells
200
   * @throws IOException if writing fails
201
   */
202
  public void writeColumnsCsv(
203
      Writer writer, List<String> headerCells, List<List<List<String>>> columns)
204
      throws IOException {
205
    try (CSVPrinter csvPrinter = new CSVPrinter(writer, CSVFormat.DEFAULT)) {
206 1 1. writeColumnsCsv : removed call to edu/ucsb/cs156/frontiers/services/TeamCsvService::printColumns → KILLED
      printColumns(csvPrinter, headerCells, columns);
207
    }
208
  }
209
210
  /**
211
   * Prints the side-by-side columns described in {@link #writeColumnsCsv} to a CSVPrinter, without
212
   * closing it, so that several tables can be printed to one CSV file.
213
   */
214
  private void printColumns(
215
      CSVPrinter csvPrinter, List<String> headerCells, List<List<List<String>>> columns)
216
      throws IOException {
217
    int width = headerCells.size();
218
    List<String> blanks = new ArrayList<>();
219 2 1. printColumns : changed conditional boundary → KILLED
2. printColumns : negated conditional → KILLED
    for (int i = 0; i < width; i++) {
220
      blanks.add("");
221
    }
222
    int rows = columns.stream().mapToInt(List::size).max().orElse(0);
223
224
    List<String> header = new ArrayList<>();
225 2 1. printColumns : negated conditional → TIMED_OUT
2. printColumns : changed conditional boundary → KILLED
    for (int c = 0; c < columns.size(); c++) {
226 2 1. printColumns : changed conditional boundary → KILLED
2. printColumns : negated conditional → KILLED
      if (c > 0) {
227
        header.add("");
228
      }
229
      header.addAll(headerCells);
230
    }
231 1 1. printColumns : removed call to org/apache/commons/csv/CSVPrinter::printRecord → KILLED
    csvPrinter.printRecord(header);
232
233 2 1. printColumns : negated conditional → TIMED_OUT
2. printColumns : changed conditional boundary → KILLED
    for (int r = 0; r < rows; r++) {
234
      List<String> row = new ArrayList<>();
235 2 1. printColumns : changed conditional boundary → KILLED
2. printColumns : negated conditional → KILLED
      for (int c = 0; c < columns.size(); c++) {
236 2 1. printColumns : changed conditional boundary → KILLED
2. printColumns : negated conditional → KILLED
        if (c > 0) {
237
          row.add("");
238
        }
239
        List<List<String>> column = columns.get(c);
240 2 1. printColumns : changed conditional boundary → KILLED
2. printColumns : negated conditional → KILLED
        row.addAll(r < column.size() ? column.get(r) : blanks);
241
      }
242 1 1. printColumns : removed call to org/apache/commons/csv/CSVPrinter::printRecord → KILLED
      csvPrinter.printRecord(row);
243
    }
244
  }
245
246
  /**
247
   * Writes the "Name,Team" table: the entries balanced across the given number of column pairs,
248
   * filling column by column.
249
   *
250
   * @param writer where to write the CSV
251
   * @param entries the entries, in order
252
   * @param columns the number of "Name,Team" column pairs, at least 1
253
   * @throws IOException if writing fails
254
   * @throws IllegalArgumentException if columns is less than 1
255
   */
256
  public void writeName2TeamCsv(Writer writer, List<NameAndTeam> entries, int columns)
257
      throws IOException {
258
    List<List<List<String>>> layout = new ArrayList<>();
259
    for (List<NameAndTeam> column : layoutColumns(entries, columns)) {
260
      layout.add(nameTeamRows(column));
261
    }
262 1 1. writeName2TeamCsv : removed call to edu/ucsb/cs156/frontiers/services/TeamCsvService::writeColumnsCsv → KILLED
    writeColumnsCsv(writer, List.of("Name", "Team"), layout);
263
  }
264
265
  /** The rows of one "Name,Team" column: one row per entry. */
266
  private static List<List<String>> nameTeamRows(List<NameAndTeam> entries) {
267 2 1. lambda$nameTeamRows$0 : replaced return value with Collections.emptyList for edu/ucsb/cs156/frontiers/services/TeamCsvService::lambda$nameTeamRows$0 → KILLED
2. nameTeamRows : replaced return value with Collections.emptyList for edu/ucsb/cs156/frontiers/services/TeamCsvService::nameTeamRows → KILLED
    return entries.stream().map(e -> List.of(e.name(), e.team())).toList();
268
  }
269
270
  /** The rows of one "Team,Name" column: one row per member of each of the teams, in order. */
271
  private static List<List<String>> teamNameRows(List<List<NameAndTeam>> teams) {
272
    List<List<String>> rows = new ArrayList<>();
273
    for (List<NameAndTeam> team : teams) {
274
      for (NameAndTeam entry : team) {
275
        rows.add(List.of(entry.team(), entry.name()));
276
      }
277
    }
278 1 1. teamNameRows : replaced return value with Collections.emptyList for edu/ucsb/cs156/frontiers/services/TeamCsvService::teamNameRows → KILLED
    return rows;
279
  }
280
281
  /**
282
   * Groups the entries by team, one list per team, with the teams in case-insensitive alphabetical
283
   * order by name and the entries within each team in their original order. Entries with no team (a
284
   * blank team name) are collected into one extra group placed last, so that unassigned students
285
   * are still visible.
286
   *
287
   * @param entries the entries, in order
288
   * @return one list per team, teams sorted by name, unassigned students last
289
   */
290
  public List<List<NameAndTeam>> groupByTeam(List<NameAndTeam> entries) {
291
    Map<String, List<NameAndTeam>> byTeam =
292
        new TreeMap<>(String.CASE_INSENSITIVE_ORDER.thenComparing(Comparator.naturalOrder()));
293
    List<NameAndTeam> noTeam = new ArrayList<>();
294
    for (NameAndTeam entry : entries) {
295 1 1. groupByTeam : negated conditional → KILLED
      if (entry.team().isEmpty()) {
296
        noTeam.add(entry);
297
      } else {
298 1 1. lambda$groupByTeam$0 : replaced return value with Collections.emptyList for edu/ucsb/cs156/frontiers/services/TeamCsvService::lambda$groupByTeam$0 → KILLED
        byTeam.computeIfAbsent(entry.team(), k -> new ArrayList<>()).add(entry);
299
      }
300
    }
301
    List<List<NameAndTeam>> result = new ArrayList<>(byTeam.values());
302 1 1. groupByTeam : negated conditional → KILLED
    if (!noTeam.isEmpty()) {
303
      result.add(noTeam);
304
    }
305 1 1. groupByTeam : replaced return value with Collections.emptyList for edu/ucsb/cs156/frontiers/services/TeamCsvService::groupByTeam → KILLED
    return result;
306
  }
307
308
  /**
309
   * Writes the "Team,Name" table: the teams (see {@link #groupByTeam}) balanced across the given
310
   * number of column pairs, filling column by column, with one row per student. Columns are
311
   * balanced by number of teams, not number of students, so that a team is never split across two
312
   * columns.
313
   *
314
   * @param writer where to write the CSV
315
   * @param entries the entries, in order
316
   * @param columns the number of "Team,Name" column pairs, at least 1
317
   * @throws IOException if writing fails
318
   * @throws IllegalArgumentException if columns is less than 1
319
   */
320
  public void writeTeamTableCsv(Writer writer, List<NameAndTeam> entries, int columns)
321
      throws IOException {
322
    List<List<List<String>>> layout = new ArrayList<>();
323
    for (List<List<NameAndTeam>> column : layoutColumns(groupByTeam(entries), columns)) {
324
      layout.add(teamNameRows(column));
325
    }
326 1 1. writeTeamTableCsv : removed call to edu/ucsb/cs156/frontiers/services/TeamCsvService::writeColumnsCsv → KILLED
    writeColumnsCsv(writer, List.of("Team", "Name"), layout);
327
  }
328
329
  /**
330
   * Writes the formatted teams CSV with {@link #NAMES_PER_COLUMN} names and {@link
331
   * #TEAMS_PER_COLUMN} teams per column; see {@link #writeFormattedTeamsCsv(Writer, List, int,
332
   * int)}.
333
   *
334
   * @param writer where to write the CSV
335
   * @param entries the entries, in order
336
   * @throws IOException if writing fails
337
   */
338
  public void writeFormattedTeamsCsv(Writer writer, List<NameAndTeam> entries) throws IOException {
339 1 1. writeFormattedTeamsCsv : removed call to edu/ucsb/cs156/frontiers/services/TeamCsvService::writeFormattedTeamsCsv → KILLED
    writeFormattedTeamsCsv(writer, entries, NAMES_PER_COLUMN, TEAMS_PER_COLUMN);
340
  }
341
342
  /**
343
   * Writes the formatted teams CSV: two tables, one after the other, each preceded by a title line.
344
   * The "by name" table lists every entry in "Name,Team" column pairs of {@code namesPerColumn}
345
   * rows each; the "by team" table lists the teams (see {@link #groupByTeam}) and their members in
346
   * "Team,Name" column pairs of {@code teamsPerColumn} teams each, so a team is never split. Both
347
   * fill column by column and use as many columns as needed. Imported into a spreadsheet, the file
348
   * only needs formatting and splitting into two tabs to become a team sheet.
349
   *
350
   * @param writer where to write the CSV
351
   * @param entries the entries, in order
352
   * @param namesPerColumn the most names in one column of the "by name" table, at least 1
353
   * @param teamsPerColumn the most teams in one column of the "by team" table, at least 1
354
   * @throws IOException if writing fails
355
   * @throws IllegalArgumentException if namesPerColumn or teamsPerColumn is less than 1
356
   */
357
  public void writeFormattedTeamsCsv(
358
      Writer writer, List<NameAndTeam> entries, int namesPerColumn, int teamsPerColumn)
359
      throws IOException {
360
    List<List<List<String>>> byName = new ArrayList<>();
361
    for (List<NameAndTeam> column : chunkColumns(entries, namesPerColumn)) {
362
      byName.add(nameTeamRows(column));
363
    }
364
    List<List<List<String>>> byTeam = new ArrayList<>();
365
    for (List<List<NameAndTeam>> column : chunkColumns(groupByTeam(entries), teamsPerColumn)) {
366
      byTeam.add(teamNameRows(column));
367
    }
368
    try (CSVPrinter csvPrinter = new CSVPrinter(writer, CSVFormat.DEFAULT)) {
369 1 1. writeFormattedTeamsCsv : removed call to org/apache/commons/csv/CSVPrinter::printRecord → KILLED
      csvPrinter.printRecord("by name");
370 1 1. writeFormattedTeamsCsv : removed call to edu/ucsb/cs156/frontiers/services/TeamCsvService::printColumns → KILLED
      printColumns(csvPrinter, List.of("Name", "Team"), byName);
371 1 1. writeFormattedTeamsCsv : removed call to org/apache/commons/csv/CSVPrinter::printRecord → KILLED
      csvPrinter.printRecord("by team");
372 1 1. writeFormattedTeamsCsv : removed call to edu/ucsb/cs156/frontiers/services/TeamCsvService::printColumns → KILLED
      printColumns(csvPrinter, List.of("Team", "Name"), byTeam);
373
    }
374
  }
375
376
  private static String join(String first, String lastPart) {
377 1 1. join : negated conditional → KILLED
    if (first.isEmpty()) {
378 1 1. join : replaced return value with "" for edu/ucsb/cs156/frontiers/services/TeamCsvService::join → KILLED
      return lastPart;
379
    }
380 1 1. join : negated conditional → KILLED
    if (lastPart.isEmpty()) {
381 1 1. join : replaced return value with "" for edu/ucsb/cs156/frontiers/services/TeamCsvService::join → KILLED
      return first;
382
    }
383 1 1. join : replaced return value with "" for edu/ucsb/cs156/frontiers/services/TeamCsvService::join → KILLED
    return first + " " + lastPart;
384
  }
385
386
  private static Map<String, Integer> counts(List<String> values) {
387
    Map<String, Integer> result = new HashMap<>();
388
    for (String value : values) {
389
      result.merge(value, 1, Integer::sum);
390
    }
391 1 1. counts : replaced return value with Collections.emptyMap for edu/ucsb/cs156/frontiers/services/TeamCsvService::counts → KILLED
    return result;
392
  }
393
}

Mutations

49

1.1
Location : titleCase
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:titleCase_handles_null_and_blank()]
negated conditional → KILLED

56

1.1
Location : titleCase
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:titleCase_capitalizes_first_letter_of_each_word()]
negated conditional → KILLED

57

1.1
Location : titleCase
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:titleCase_capitalizes_first_letter_of_each_word()]
negated conditional → KILLED

64

1.1
Location : titleCase
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:titleCase_capitalizes_first_letter_of_each_word()]
replaced return value with "" for edu/ucsb/cs156/frontiers/services/TeamCsvService::titleCase → KILLED

77

1.1
Location : firstWord
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:firstWord_handles_null_and_blank()]
negated conditional → KILLED

80

1.1
Location : firstWord
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:firstWord_returns_text_before_the_first_space()]
replaced return value with "" for edu/ucsb/cs156/frontiers/services/TeamCsvService::firstWord → KILLED

110

1.1
Location : nameAndTeams
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:nameAndTeams_adds_last_initial_when_first_name_is_shared()]
negated conditional → KILLED

119

1.1
Location : nameAndTeams
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:nameAndTeams_of_empty_list_is_empty()]
negated conditional → KILLED

2.2
Location : nameAndTeams
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:nameAndTeams_of_empty_list_is_empty()]
changed conditional boundary → KILLED

121

1.1
Location : nameAndTeams
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:nameAndTeams_uses_first_name_only_when_unique()]
negated conditional → KILLED

123

1.1
Location : nameAndTeams
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:nameAndTeams_adds_last_initial_when_first_name_is_shared()]
negated conditional → KILLED

125

1.1
Location : nameAndTeams
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:nameAndTeams_marks_exact_duplicates_with_asterisk()]
negated conditional → KILLED

131

1.1
Location : nameAndTeams
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:nameAndTeams_uses_first_name_only_when_unique()]
negated conditional → KILLED

134

1.1
Location : nameAndTeams
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:nameAndTeams_uses_first_name_only_when_unique()]
replaced return value with Collections.emptyList for edu/ucsb/cs156/frontiers/services/TeamCsvService::nameAndTeams → KILLED

150

1.1
Location : layoutColumns
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:layoutColumns_rejects_less_than_one_column()]
negated conditional → KILLED

2.2
Location : layoutColumns
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:layoutColumns_single_column_keeps_everything_together()]
changed conditional boundary → KILLED

153

1.1
Location : layoutColumns
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:layoutColumns_divides_evenly_when_possible()]
Replaced integer division with multiplication → KILLED

154

1.1
Location : layoutColumns
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:layoutColumns_single_column_keeps_everything_together()]
Replaced integer modulus with multiplication → KILLED

157

1.1
Location : layoutColumns
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:layoutColumns_single_column_keeps_everything_together()]
negated conditional → KILLED

2.2
Location : layoutColumns
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:layoutColumns_single_column_keeps_everything_together()]
changed conditional boundary → KILLED

158

1.1
Location : layoutColumns
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:layoutColumns_single_column_keeps_everything_together()]
changed conditional boundary → KILLED

2.2
Location : layoutColumns
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:layoutColumns_single_column_keeps_everything_together()]
negated conditional → KILLED

3.3
Location : layoutColumns
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:layoutColumns_gives_extra_items_to_the_first_columns()]
Replaced integer addition with subtraction → KILLED

159

1.1
Location : layoutColumns
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:layoutColumns_single_column_keeps_everything_together()]
Replaced integer addition with subtraction → KILLED

160

1.1
Location : layoutColumns
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:layoutColumns_divides_evenly_when_possible()]
Replaced integer addition with subtraction → KILLED

162

1.1
Location : layoutColumns
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:layoutColumns_single_column_keeps_everything_together()]
replaced return value with Collections.emptyList for edu/ucsb/cs156/frontiers/services/TeamCsvService::layoutColumns → KILLED

178

1.1
Location : chunkColumns
Killed by : none
negated conditional → TIMED_OUT

2.2
Location : chunkColumns
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:chunkColumns_with_one_item_per_column()]
changed conditional boundary → KILLED

182

1.1
Location : chunkColumns
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:chunkColumns_with_one_item_per_column()]
Replaced integer addition with subtraction → KILLED

2.2
Location : chunkColumns
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:chunkColumns_with_one_item_per_column()]
changed conditional boundary → KILLED

3.3
Location : chunkColumns
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:chunkColumns_with_one_item_per_column()]
negated conditional → KILLED

183

1.1
Location : chunkColumns
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:chunkColumns_with_one_item_per_column()]
Replaced integer addition with subtraction → KILLED

185

1.1
Location : chunkColumns
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:chunkColumns_with_one_item_per_column()]
negated conditional → KILLED

188

1.1
Location : chunkColumns
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:chunkColumns_with_one_item_per_column()]
replaced return value with Collections.emptyList for edu/ucsb/cs156/frontiers/services/TeamCsvService::chunkColumns → KILLED

206

1.1
Location : writeColumnsCsv
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:writeColumnsCsv_with_no_columns_writes_an_empty_header_line()]
removed call to edu/ucsb/cs156/frontiers/services/TeamCsvService::printColumns → KILLED

219

1.1
Location : printColumns
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:writeColumnsCsv_longest_column_need_not_be_first()]
changed conditional boundary → KILLED

2.2
Location : printColumns
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:writeColumnsCsv_longest_column_need_not_be_first()]
negated conditional → KILLED

225

1.1
Location : printColumns
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:writeColumnsCsv_with_no_columns_writes_an_empty_header_line()]
changed conditional boundary → KILLED

2.2
Location : printColumns
Killed by : none
negated conditional → TIMED_OUT

226

1.1
Location : printColumns
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:writeColumnsCsv_longest_column_need_not_be_first()]
changed conditional boundary → KILLED

2.2
Location : printColumns
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:writeColumnsCsv_longest_column_need_not_be_first()]
negated conditional → KILLED

231

1.1
Location : printColumns
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:writeColumnsCsv_with_no_columns_writes_an_empty_header_line()]
removed call to org/apache/commons/csv/CSVPrinter::printRecord → KILLED

233

1.1
Location : printColumns
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:writeColumnsCsv_with_no_columns_writes_an_empty_header_line()]
changed conditional boundary → KILLED

2.2
Location : printColumns
Killed by : none
negated conditional → TIMED_OUT

235

1.1
Location : printColumns
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:writeColumnsCsv_longest_column_need_not_be_first()]
changed conditional boundary → KILLED

2.2
Location : printColumns
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:writeColumnsCsv_longest_column_need_not_be_first()]
negated conditional → KILLED

236

1.1
Location : printColumns
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:writeColumnsCsv_longest_column_need_not_be_first()]
changed conditional boundary → KILLED

2.2
Location : printColumns
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:writeColumnsCsv_pads_shorter_columns_with_blank_cells()]
negated conditional → KILLED

240

1.1
Location : printColumns
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:writeColumnsCsv_longest_column_need_not_be_first()]
changed conditional boundary → KILLED

2.2
Location : printColumns
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:writeColumnsCsv_longest_column_need_not_be_first()]
negated conditional → KILLED

242

1.1
Location : printColumns
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:writeColumnsCsv_longest_column_need_not_be_first()]
removed call to org/apache/commons/csv/CSVPrinter::printRecord → KILLED

262

1.1
Location : writeName2TeamCsv
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:writeName2TeamCsv_with_no_entries_writes_only_the_header()]
removed call to edu/ucsb/cs156/frontiers/services/TeamCsvService::writeColumnsCsv → KILLED

267

1.1
Location : lambda$nameTeamRows$0
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:writeName2TeamCsv_single_column()]
replaced return value with Collections.emptyList for edu/ucsb/cs156/frontiers/services/TeamCsvService::lambda$nameTeamRows$0 → KILLED

2.2
Location : nameTeamRows
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:writeName2TeamCsv_single_column()]
replaced return value with Collections.emptyList for edu/ucsb/cs156/frontiers/services/TeamCsvService::nameTeamRows → KILLED

278

1.1
Location : teamNameRows
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:writeTeamTableCsv_pads_short_columns_and_quotes_leading_blank_cells()]
replaced return value with Collections.emptyList for edu/ucsb/cs156/frontiers/services/TeamCsvService::teamNameRows → KILLED

295

1.1
Location : groupByTeam
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:groupByTeam_puts_students_with_no_team_last()]
negated conditional → KILLED

298

1.1
Location : lambda$groupByTeam$0
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:groupByTeam_puts_students_with_no_team_last()]
replaced return value with Collections.emptyList for edu/ucsb/cs156/frontiers/services/TeamCsvService::lambda$groupByTeam$0 → KILLED

302

1.1
Location : groupByTeam
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:groupByTeam_of_empty_list_is_empty()]
negated conditional → KILLED

305

1.1
Location : groupByTeam
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:groupByTeam_puts_students_with_no_team_last()]
replaced return value with Collections.emptyList for edu/ucsb/cs156/frontiers/services/TeamCsvService::groupByTeam → KILLED

326

1.1
Location : writeTeamTableCsv
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:writeTeamTableCsv_with_no_entries_writes_only_the_header()]
removed call to edu/ucsb/cs156/frontiers/services/TeamCsvService::writeColumnsCsv → KILLED

339

1.1
Location : writeFormattedTeamsCsv
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:writeFormattedTeamsCsv_uses_the_default_layout_when_none_is_given()]
removed call to edu/ucsb/cs156/frontiers/services/TeamCsvService::writeFormattedTeamsCsv → KILLED

369

1.1
Location : writeFormattedTeamsCsv
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:writeFormattedTeamsCsv_with_no_entries_writes_titles_and_headers_only()]
removed call to org/apache/commons/csv/CSVPrinter::printRecord → KILLED

370

1.1
Location : writeFormattedTeamsCsv
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:writeFormattedTeamsCsv_with_no_entries_writes_titles_and_headers_only()]
removed call to edu/ucsb/cs156/frontiers/services/TeamCsvService::printColumns → KILLED

371

1.1
Location : writeFormattedTeamsCsv
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:writeFormattedTeamsCsv_with_no_entries_writes_titles_and_headers_only()]
removed call to org/apache/commons/csv/CSVPrinter::printRecord → KILLED

372

1.1
Location : writeFormattedTeamsCsv
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:writeFormattedTeamsCsv_with_no_entries_writes_titles_and_headers_only()]
removed call to edu/ucsb/cs156/frontiers/services/TeamCsvService::printColumns → KILLED

377

1.1
Location : join
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:nameAndTeams_adds_last_initial_when_first_name_is_shared()]
negated conditional → KILLED

378

1.1
Location : join
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:nameAndTeams_handles_missing_first_names()]
replaced return value with "" for edu/ucsb/cs156/frontiers/services/TeamCsvService::join → KILLED

380

1.1
Location : join
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:nameAndTeams_adds_last_initial_when_first_name_is_shared()]
negated conditional → KILLED

381

1.1
Location : join
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:nameAndTeams_handles_missing_last_names()]
replaced return value with "" for edu/ucsb/cs156/frontiers/services/TeamCsvService::join → KILLED

383

1.1
Location : join
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:nameAndTeams_adds_last_initial_when_first_name_is_shared()]
replaced return value with "" for edu/ucsb/cs156/frontiers/services/TeamCsvService::join → KILLED

391

1.1
Location : counts
Killed by : edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.frontiers.services.TeamCsvServiceTests]/[method:nameAndTeams_uses_first_name_only_when_unique()]
replaced return value with Collections.emptyMap for edu/ucsb/cs156/frontiers/services/TeamCsvService::counts → KILLED

Active mutators

Tests examined


Report generated by PIT 1.30.0 support