UCSBCurriculumService.java

1
package edu.ucsb.cs156.courses.services;
2
3
import com.fasterxml.jackson.core.type.TypeReference;
4
import com.fasterxml.jackson.databind.ObjectMapper;
5
import edu.ucsb.cs156.courses.documents.ConvertedSection;
6
import edu.ucsb.cs156.courses.documents.CoursePage;
7
import edu.ucsb.cs156.courses.documents.GERequirement;
8
import edu.ucsb.cs156.courses.documents.Primary;
9
import java.time.Duration;
10
import java.util.ArrayList;
11
import java.util.Arrays;
12
import java.util.HashMap;
13
import java.util.List;
14
import java.util.Map;
15
import java.util.stream.Collectors;
16
import lombok.extern.slf4j.Slf4j;
17
import org.springframework.beans.factory.annotation.Autowired;
18
import org.springframework.beans.factory.annotation.Value;
19
import org.springframework.boot.web.client.RestTemplateBuilder;
20
import org.springframework.http.HttpEntity;
21
import org.springframework.http.HttpHeaders;
22
import org.springframework.http.HttpMethod;
23
import org.springframework.http.HttpStatus;
24
import org.springframework.http.MediaType;
25
import org.springframework.http.ResponseEntity;
26
import org.springframework.stereotype.Service;
27
import org.springframework.web.client.RestTemplate;
28
29
/** Service object that wraps the UCSB Academic Curriculum API */
30
@Service
31
@Slf4j
32
public class UCSBCurriculumService {
33
34
  @Autowired private ObjectMapper objectMapper;
35
36
  @Autowired private ConvertedSectionUpsertService upsertService;
37
38
  @Value("${app.ucsb.api.consumer_key}")
39
  private String apiKey;
40
41
  @Value("${app.ucsb.api.host}")
42
  private String apiHost;
43
44
  private static final Duration CONNECT_TIMEOUT = Duration.ofSeconds(10);
45
  private static final Duration READ_TIMEOUT = Duration.ofSeconds(60);
46
47
  private RestTemplate restTemplate = new RestTemplate();
48
49
  public UCSBCurriculumService(RestTemplateBuilder restTemplateBuilder) throws Exception {
50
    restTemplate =
51
        restTemplateBuilder.connectTimeout(CONNECT_TIMEOUT).readTimeout(READ_TIMEOUT).build();
52
  }
53
54
  public static final String CURRICULUM_ENDPOINT =
55
      "{apiHost}/academics/curriculums/v1/classes/search";
56
57
  public static final String SUBJECTS_ENDPOINT = "{apiHost}/students/lookups/v1/subjects";
58
59
  public static final String SECTION_ENDPOINT =
60
      "{apiHost}/academics/curriculums/v1/classsection/{quarter}/{enrollcode}";
61
62
  public static final String ALL_SECTIONS_ENDPOINT =
63
      "{apiHost}/academics/curriculums/v3/classes/{quarter}/{enrollcode}";
64
65
  public static final String FINALS_ENDPOINT = "{apiHost}/academics/curriculums/v3/finals";
66
67
  public static final String GE_ENDPOINT = "{apiHost}/students/lookups/v1/requirements";
68
69
  public String getJSON(String subjectArea, String quarter, String courseLevel) throws Exception {
70 1 1. getJSON : replaced return value with "" for edu/ucsb/cs156/courses/services/UCSBCurriculumService::getJSON → KILLED
    return getJSON(subjectArea, quarter, courseLevel, 1);
71
  }
72
73
  public String getJSON(String subjectArea, String quarter, String courseLevel, int pageNumber)
74
      throws Exception {
75
76
    HttpHeaders headers = new HttpHeaders();
77 1 1. getJSON : removed call to org/springframework/http/HttpHeaders::setAccept → KILLED
    headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON));
78 1 1. getJSON : removed call to org/springframework/http/HttpHeaders::setContentType → KILLED
    headers.setContentType(MediaType.APPLICATION_JSON);
79 1 1. getJSON : removed call to org/springframework/http/HttpHeaders::set → KILLED
    headers.set("ucsb-api-version", "1.0");
80 1 1. getJSON : removed call to org/springframework/http/HttpHeaders::set → KILLED
    headers.set("ucsb-api-key", this.apiKey);
81
82
    HttpEntity<String> entity = new HttpEntity<>("body", headers);
83
84
    String params =
85
        String.format(
86
            "?quarter=%s&subjectCode=%s&objLevelCode=%s&pageNumber=%d&pageSize=%d&includeClassSections=%s",
87
            quarter, subjectArea, courseLevel, pageNumber, 100, "true");
88
    String url = CURRICULUM_ENDPOINT + params;
89
90 1 1. getJSON : negated conditional → KILLED
    if (courseLevel.equals("A")) {
91
      params =
92
          String.format(
93
              "?quarter=%s&subjectCode=%s&pageNumber=%d&pageSize=%d&includeClassSections=%s",
94
              quarter, subjectArea, pageNumber, 100, "true");
95
      url = CURRICULUM_ENDPOINT + params;
96
    }
97
98
    url = url.replace("{apiHost}", apiHost);
99
100
    log.info("url=" + url);
101
102
    String retVal = "";
103
    MediaType contentType = null;
104
    HttpStatus statusCode = null;
105
106
    ResponseEntity<String> re = restTemplate.exchange(url, HttpMethod.GET, entity, String.class);
107
    contentType = re.getHeaders().getContentType();
108
    statusCode = (HttpStatus) re.getStatusCode();
109
    retVal = re.getBody();
110
111
    log.trace("json: {}", retVal);
112
    log.info("contentType: {} statusCode: {}", contentType, statusCode);
113 1 1. getJSON : replaced return value with "" for edu/ucsb/cs156/courses/services/UCSBCurriculumService::getJSON → KILLED
    return retVal;
114
  }
115
116
  public List<ConvertedSection> getConvertedSections(
117
      String subjectArea, String quarter, String courseLevel) throws Exception {
118
    List<ConvertedSection> result = new ArrayList<>();
119
    int pageNumber = 1;
120
    int coursesRead = 0;
121
    int totalCourses = -1;
122
123
    do {
124
      String json = getJSON(subjectArea, quarter, courseLevel, pageNumber);
125
      CoursePage coursePage = objectMapper.readValue(json, CoursePage.class);
126
127 1 1. getConvertedSections : negated conditional → KILLED
      if (pageNumber == 1) {
128
        totalCourses = coursePage.getTotal();
129
      }
130
131 2 1. getConvertedSections : negated conditional → KILLED
2. getConvertedSections : negated conditional → KILLED
      if (coursePage.getPageNumber() != pageNumber || coursePage.getTotal() != totalCourses) {
132
        throw new IllegalStateException("Inconsistent course pagination");
133
      }
134
135
      int coursesOnPage = coursePage.getClasses().size();
136 3 1. getConvertedSections : changed conditional boundary → KILLED
2. getConvertedSections : negated conditional → KILLED
3. getConvertedSections : negated conditional → KILLED
      if (coursesOnPage == 0 && coursesRead < totalCourses) {
137
        throw new IllegalStateException("Course data ended before the reported total");
138
      }
139
140 1 1. getConvertedSections : Replaced integer addition with subtraction → KILLED
      coursesRead += coursesOnPage;
141
      result.addAll(coursePage.convertedSections());
142 1 1. getConvertedSections : Changed increment from 1 to -1 → KILLED
      pageNumber++;
143 2 1. getConvertedSections : changed conditional boundary → KILLED
2. getConvertedSections : negated conditional → KILLED
    } while (coursesRead < totalCourses);
144
145 1 1. getConvertedSections : negated conditional → KILLED
    if (coursesRead != totalCourses) {
146
      throw new IllegalStateException("Course count does not match the reported total");
147
    }
148
149 1 1. getConvertedSections : replaced return value with Collections.emptyList for edu/ucsb/cs156/courses/services/UCSBCurriculumService::getConvertedSections → KILLED
    return result;
150
  }
151
152
  /**
153
   * This method retrieves course information and reformats it so that each primary is a single
154
   * object, that has a list of all of it's secondaries.
155
   *
156
   * <p>As a reminder, the UCSB course registration systems (GOLD, Blue, Star, etc.) treat all
157
   * courses as "sections", even what we typically call "lectures". In the database, some courses
158
   * have both primary and secondary sections. Primary sections have section numbers ending in 00
159
   * (e.g. 100, 200, 300, up to 9900), while secondaries have numbers ending with 01, 02, 03, etc.
160
   * and "belong" with a primary.
161
   *
162
   * <p>What we typically refer to as "lectures" are primary sections ending in 00 (e.g. 100, 200,
163
   * 300). What we typically refer to as discussion sections are secondaries and end with 01, 02,
164
   * 03, etc.
165
   *
166
   * <p>
167
   *
168
   * <p>The UCSB API <i>almost</i> does this, but not quite. It returns a list of all sections, but
169
   * does not group them into primaries and secondaries. This method relies on the <code>
170
   * getPrimaries</code> method of the <code>Page</code> class to reformat the data so that each
171
   * primary section is a single object, with a list of all of its secondaries.
172
   *
173
   * @param subjectArea
174
   * @param quarter
175
   * @param courseLevel
176
   * @return a list of Primaries
177
   * @throws Exception
178
   */
179
  public List<Primary> getPrimaries(String subjectArea, String quarter, String courseLevel)
180
      throws Exception {
181
    String json = getJSON(subjectArea, quarter, courseLevel);
182
    CoursePage coursePage = objectMapper.readValue(json, CoursePage.class);
183
    for (ConvertedSection section : coursePage.convertedSections()) {
184
      try {
185 1 1. getPrimaries : removed call to edu/ucsb/cs156/courses/services/ConvertedSectionUpsertService::upsert → KILLED
        upsertService.upsert(section);
186
      } catch (RuntimeException e) {
187
        log.warn("Unable to cache course section from live search", e);
188
      }
189
    }
190
    List<Primary> result = coursePage.getPrimaries();
191 1 1. getPrimaries : replaced return value with Collections.emptyList for edu/ucsb/cs156/courses/services/UCSBCurriculumService::getPrimaries → KILLED
    return result;
192
  }
193
194
  public String getJSONByGE(String quarter, String area) throws Exception {
195
    HttpHeaders headers = new HttpHeaders();
196 1 1. getJSONByGE : removed call to org/springframework/http/HttpHeaders::setAccept → KILLED
    headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON));
197 1 1. getJSONByGE : removed call to org/springframework/http/HttpHeaders::setContentType → KILLED
    headers.setContentType(MediaType.APPLICATION_JSON);
198 1 1. getJSONByGE : removed call to org/springframework/http/HttpHeaders::set → KILLED
    headers.set("ucsb-api-version", "1.0");
199 1 1. getJSONByGE : removed call to org/springframework/http/HttpHeaders::set → KILLED
    headers.set("ucsb-api-key", this.apiKey);
200
201
    HttpEntity<String> entity = new HttpEntity<>("body", headers);
202
203
    String params =
204
        String.format("?quarter=%s&areas=%s&pageNumber=%d&pageSize=%d", quarter, area, 1, 500);
205
    String url = (CURRICULUM_ENDPOINT + params).replace("{apiHost}", apiHost);
206
207
    log.info("url=" + url);
208
209
    String retVal = "";
210
    MediaType contentType = null;
211
    HttpStatus statusCode = null;
212
213
    ResponseEntity<String> re = restTemplate.exchange(url, HttpMethod.GET, entity, String.class);
214
    contentType = re.getHeaders().getContentType();
215
    statusCode = (HttpStatus) re.getStatusCode();
216
    retVal = re.getBody();
217
218
    log.trace("json: {}", retVal);
219
    log.info("contentType: {} statusCode: {}", contentType, statusCode);
220 1 1. getJSONByGE : replaced return value with "" for edu/ucsb/cs156/courses/services/UCSBCurriculumService::getJSONByGE → KILLED
    return retVal;
221
  }
222
223
  public List<Primary> getPrimariesByGE(String quarter, String area) throws Exception {
224
    String json = getJSONByGE(quarter, area);
225
    CoursePage coursePage = objectMapper.readValue(json, CoursePage.class);
226
    List<Primary> result = coursePage.getPrimaries();
227 1 1. getPrimariesByGE : replaced return value with Collections.emptyList for edu/ucsb/cs156/courses/services/UCSBCurriculumService::getPrimariesByGE → KILLED
    return result;
228
  }
229
230
  public String getSectionJSON(String subjectArea, String quarter, String courseLevel)
231
      throws Exception {
232
    List<ConvertedSection> l = getConvertedSections(subjectArea, quarter, courseLevel);
233
234
    String arrayToJson = objectMapper.writeValueAsString(l);
235
236 1 1. getSectionJSON : replaced return value with "" for edu/ucsb/cs156/courses/services/UCSBCurriculumService::getSectionJSON → KILLED
    return arrayToJson;
237
  }
238
239
  public String getSubjectsJSON() throws Exception {
240
241
    HttpHeaders headers = new HttpHeaders();
242 1 1. getSubjectsJSON : removed call to org/springframework/http/HttpHeaders::setAccept → KILLED
    headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON));
243 1 1. getSubjectsJSON : removed call to org/springframework/http/HttpHeaders::setContentType → KILLED
    headers.setContentType(MediaType.APPLICATION_JSON);
244 1 1. getSubjectsJSON : removed call to org/springframework/http/HttpHeaders::set → KILLED
    headers.set("ucsb-api-version", "1.0");
245 1 1. getSubjectsJSON : removed call to org/springframework/http/HttpHeaders::set → KILLED
    headers.set("ucsb-api-key", this.apiKey);
246
247
    HttpEntity<String> entity = new HttpEntity<>("body", headers);
248
249
    String url = SUBJECTS_ENDPOINT.replace("{apiHost}", apiHost);
250
251
    log.info("url=" + url);
252
253
    String retVal = "";
254
    MediaType contentType = null;
255
    HttpStatus statusCode = null;
256
257
    ResponseEntity<String> re = restTemplate.exchange(url, HttpMethod.GET, entity, String.class);
258
    contentType = re.getHeaders().getContentType();
259
    statusCode = (HttpStatus) re.getStatusCode();
260
    retVal = re.getBody();
261
262
    log.info("json: {} contentType: {} statusCode: {}", retVal, contentType, statusCode);
263 1 1. getSubjectsJSON : replaced return value with "" for edu/ucsb/cs156/courses/services/UCSBCurriculumService::getSubjectsJSON → KILLED
    return retVal;
264
  }
265
266
  /**
267
   * This method retrieves exactly one section matching the enrollCode and quarter arguments, if
268
   * such a section exists.
269
   */
270
  public String getSection(String enrollCode, String quarter) throws Exception {
271
272
    HttpHeaders headers = new HttpHeaders();
273 1 1. getSection : removed call to org/springframework/http/HttpHeaders::setAccept → KILLED
    headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON));
274 1 1. getSection : removed call to org/springframework/http/HttpHeaders::setContentType → KILLED
    headers.setContentType(MediaType.APPLICATION_JSON);
275 1 1. getSection : removed call to org/springframework/http/HttpHeaders::set → KILLED
    headers.set("ucsb-api-version", "1.0");
276 1 1. getSection : removed call to org/springframework/http/HttpHeaders::set → KILLED
    headers.set("ucsb-api-key", this.apiKey);
277
278
    HttpEntity<String> entity = new HttpEntity<>("body", headers);
279
280
    String url = SECTION_ENDPOINT.replace("{apiHost}", apiHost);
281
282
    log.info("url=" + url);
283
284
    Map<String, String> params = new HashMap<>();
285
    params.put("quarter", quarter);
286
    params.put("enrollcode", enrollCode);
287
288
    String retVal = "";
289
    MediaType contentType = null;
290
    HttpStatus statusCode = null;
291
292
    ResponseEntity<String> re =
293
        restTemplate.exchange(url, HttpMethod.GET, entity, String.class, params);
294
    contentType = re.getHeaders().getContentType();
295
    statusCode = (HttpStatus) re.getStatusCode();
296
    retVal = re.getBody();
297
298 1 1. getSection : negated conditional → KILLED
    if (retVal.equals("null")) {
299
      retVal = "{\"error\": \"Enroll code doesn't exist in that quarter.\"}";
300
    }
301
302
    log.info("json: {} contentType: {} statusCode: {}", retVal, contentType, statusCode);
303 1 1. getSection : replaced return value with "" for edu/ucsb/cs156/courses/services/UCSBCurriculumService::getSection → KILLED
    return retVal;
304
  }
305
306
  /**
307
   * This method retrieves all of the sections related to a certain enroll code. For example, if the
308
   * enrollCode is for a discussion section, the lecture section and all related discussion sections
309
   * will also be returned.
310
   */
311
  public String getAllSections(String enrollCode, String quarter) throws Exception {
312
313
    HttpHeaders headers = new HttpHeaders();
314 1 1. getAllSections : removed call to org/springframework/http/HttpHeaders::setAccept → KILLED
    headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON));
315 1 1. getAllSections : removed call to org/springframework/http/HttpHeaders::setContentType → KILLED
    headers.setContentType(MediaType.APPLICATION_JSON);
316 1 1. getAllSections : removed call to org/springframework/http/HttpHeaders::set → KILLED
    headers.set("ucsb-api-version", "3.0");
317 1 1. getAllSections : removed call to org/springframework/http/HttpHeaders::set → KILLED
    headers.set("ucsb-api-key", this.apiKey);
318
319
    HttpEntity<String> entity = new HttpEntity<>("body", headers);
320
321
    String url = ALL_SECTIONS_ENDPOINT.replace("{apiHost}", apiHost);
322
323
    log.info("url=" + url);
324
325
    Map<String, String> params = new HashMap<>();
326
    params.put("quarter", quarter);
327
    params.put("enrollcode", enrollCode);
328
329
    String retVal = "";
330
    MediaType contentType = null;
331
    HttpStatus statusCode = null;
332
333
    ResponseEntity<String> re =
334
        restTemplate.exchange(url, HttpMethod.GET, entity, String.class, params);
335
    contentType = re.getHeaders().getContentType();
336
    statusCode = (HttpStatus) re.getStatusCode();
337
    retVal = re.getBody();
338
339 1 1. getAllSections : negated conditional → KILLED
    if (retVal.equals("null")) {
340
      retVal = "{\"error\": \"Enroll code doesn't exist in that quarter.\"}";
341
    }
342
343
    log.info("json: {} contentType: {} statusCode: {}", retVal, contentType, statusCode);
344 1 1. getAllSections : replaced return value with "" for edu/ucsb/cs156/courses/services/UCSBCurriculumService::getAllSections → KILLED
    return retVal;
345
  }
346
347
  public String getJSONbyQtrEnrollCd(String quarter, String enrollCd) throws Exception {
348
349
    HttpHeaders headers = new HttpHeaders();
350 1 1. getJSONbyQtrEnrollCd : removed call to org/springframework/http/HttpHeaders::setAccept → KILLED
    headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON));
351 1 1. getJSONbyQtrEnrollCd : removed call to org/springframework/http/HttpHeaders::setContentType → KILLED
    headers.setContentType(MediaType.APPLICATION_JSON);
352 1 1. getJSONbyQtrEnrollCd : removed call to org/springframework/http/HttpHeaders::set → KILLED
    headers.set("ucsb-api-version", "1.0");
353 1 1. getJSONbyQtrEnrollCd : removed call to org/springframework/http/HttpHeaders::set → KILLED
    headers.set("ucsb-api-key", this.apiKey);
354
355
    HttpEntity<String> entity = new HttpEntity<>("body", headers);
356
357
    String url = "{apiHost}/academics/curriculums/v3/classsection/" + quarter + "/" + enrollCd;
358
    url = url.replace("{apiHost}", apiHost);
359
360
    log.info("url=" + url);
361
362
    String retVal = "";
363
    MediaType contentType = null;
364
    HttpStatus statusCode = null;
365
366
    ResponseEntity<String> re = restTemplate.exchange(url, HttpMethod.GET, entity, String.class);
367
    contentType = re.getHeaders().getContentType();
368
    statusCode = (HttpStatus) re.getStatusCode();
369
    retVal = re.getBody();
370
371
    log.info("json: {} contentType: {} statusCode: {}", retVal, contentType, statusCode);
372 1 1. getJSONbyQtrEnrollCd : replaced return value with "" for edu/ucsb/cs156/courses/services/UCSBCurriculumService::getJSONbyQtrEnrollCd → KILLED
    return retVal;
373
  }
374
375
  public String getFinalsInfo(String quarter, String enrollCd) throws Exception {
376
    HttpHeaders headers = new HttpHeaders();
377 1 1. getFinalsInfo : removed call to org/springframework/http/HttpHeaders::setAccept → KILLED
    headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON));
378 1 1. getFinalsInfo : removed call to org/springframework/http/HttpHeaders::set → KILLED
    headers.set("ucsb-api-version", "3.0");
379 1 1. getFinalsInfo : removed call to org/springframework/http/HttpHeaders::set → KILLED
    headers.set("ucsb-api-key", this.apiKey);
380
381
    HttpEntity<String> entity = new HttpEntity<>("body", headers);
382
383
    String params = String.format("?quarter=%s&enrollCode=%s", quarter, enrollCd);
384
    String url = (FINALS_ENDPOINT + params).replace("{apiHost}", apiHost);
385
386
    log.info("url=" + url);
387
388
    String retVal;
389
    MediaType contentType;
390
    HttpStatus statusCode;
391
392
    ResponseEntity<String> re = restTemplate.exchange(url, HttpMethod.GET, entity, String.class);
393
    contentType = re.getHeaders().getContentType();
394
    statusCode = (HttpStatus) re.getStatusCode();
395
    retVal = re.getBody();
396
397
    log.info("json: {} contentType: {} statusCode: {}", retVal, contentType, statusCode);
398 1 1. getFinalsInfo : replaced return value with "" for edu/ucsb/cs156/courses/services/UCSBCurriculumService::getFinalsInfo → KILLED
    return retVal;
399
  }
400
401
  public String getGeneralEducationInfo() throws Exception {
402
    HttpHeaders headers = new HttpHeaders();
403 1 1. getGeneralEducationInfo : removed call to org/springframework/http/HttpHeaders::setAccept → KILLED
    headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON));
404 1 1. getGeneralEducationInfo : removed call to org/springframework/http/HttpHeaders::setContentType → KILLED
    headers.setContentType(MediaType.APPLICATION_JSON);
405 1 1. getGeneralEducationInfo : removed call to org/springframework/http/HttpHeaders::set → KILLED
    headers.set("ucsb-api-version", "1.0");
406 1 1. getGeneralEducationInfo : removed call to org/springframework/http/HttpHeaders::set → KILLED
    headers.set("ucsb-api-key", this.apiKey);
407
408
    HttpEntity<String> entity = new HttpEntity<>("body", headers);
409
410
    String url = GE_ENDPOINT.replace("{apiHost}", apiHost);
411
412
    log.info("Fetching GE areas from {}", url);
413
    ResponseEntity<String> response =
414
        restTemplate.exchange(url, HttpMethod.GET, entity, String.class);
415
416
    log.debug("GE areas JSON: {}", response.getBody());
417 1 1. getGeneralEducationInfo : replaced return value with "" for edu/ucsb/cs156/courses/services/UCSBCurriculumService::getGeneralEducationInfo → KILLED
    return response.getBody();
418
  }
419
420
  public List<String> getRequirementCodesByCollege(String collegeCode) throws Exception {
421
    String json = getGeneralEducationInfo();
422
423
    List<GERequirement> allAreas =
424
        objectMapper.readValue(json, new TypeReference<List<GERequirement>>() {});
425
426 1 1. getRequirementCodesByCollege : replaced return value with Collections.emptyList for edu/ucsb/cs156/courses/services/UCSBCurriculumService::getRequirementCodesByCollege → KILLED
    return allAreas.stream()
427 2 1. lambda$getRequirementCodesByCollege$0 : replaced boolean return with false for edu/ucsb/cs156/courses/services/UCSBCurriculumService::lambda$getRequirementCodesByCollege$0 → KILLED
2. lambda$getRequirementCodesByCollege$0 : replaced boolean return with true for edu/ucsb/cs156/courses/services/UCSBCurriculumService::lambda$getRequirementCodesByCollege$0 → KILLED
        .filter(area -> area.getCollegeCode().equalsIgnoreCase(collegeCode))
428
        .map(GERequirement::getRequirementCode)
429
        .distinct()
430
        .collect(Collectors.toList());
431
  }
432
}

Mutations

70

1.1
Location : getJSON
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getJSON_success()]
replaced return value with "" for edu/ucsb/cs156/courses/services/UCSBCurriculumService::getJSON → KILLED

77

1.1
Location : getJSON
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getJSON_success()]
removed call to org/springframework/http/HttpHeaders::setAccept → KILLED

78

1.1
Location : getJSON
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getJSON_success()]
removed call to org/springframework/http/HttpHeaders::setContentType → KILLED

79

1.1
Location : getJSON
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getJSON_success()]
removed call to org/springframework/http/HttpHeaders::set → KILLED

80

1.1
Location : getJSON
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getJSON_success()]
removed call to org/springframework/http/HttpHeaders::set → KILLED

90

1.1
Location : getJSON
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getJSON_success()]
negated conditional → KILLED

113

1.1
Location : getJSON
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getJSON_success()]
replaced return value with "" for edu/ucsb/cs156/courses/services/UCSBCurriculumService::getJSON → KILLED

127

1.1
Location : getConvertedSections
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getConvertedSections_emptyResult()]
negated conditional → KILLED

131

1.1
Location : getConvertedSections
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getConvertedSections_emptyResult()]
negated conditional → KILLED

2.2
Location : getConvertedSections
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getConvertedSections_emptyResult()]
negated conditional → KILLED

136

1.1
Location : getConvertedSections
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getConvertedSections_emptyResult()]
changed conditional boundary → KILLED

2.2
Location : getConvertedSections
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getConvertedSections_emptyResult()]
negated conditional → KILLED

3.3
Location : getConvertedSections
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getConvertedSections_secondPageFailure()]
negated conditional → KILLED

140

1.1
Location : getConvertedSections
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[test-template:test_getConvertedSections_rejectsInvalidPagination(java.lang.String, int, int, int)]/[test-template-invocation:#4]
Replaced integer addition with subtraction → KILLED

142

1.1
Location : getConvertedSections
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getConvertedSections_secondPageFailure()]
Changed increment from 1 to -1 → KILLED

143

1.1
Location : getConvertedSections
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getConvertedSections_emptyResult()]
changed conditional boundary → KILLED

2.2
Location : getConvertedSections
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getConvertedSections_emptyResult()]
negated conditional → KILLED

145

1.1
Location : getConvertedSections
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getConvertedSections_emptyResult()]
negated conditional → KILLED

149

1.1
Location : getConvertedSections
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getConvertedSections()]
replaced return value with Collections.emptyList for edu/ucsb/cs156/courses/services/UCSBCurriculumService::getConvertedSections → KILLED

185

1.1
Location : getPrimaries
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getPrimaries()]
removed call to edu/ucsb/cs156/courses/services/ConvertedSectionUpsertService::upsert → KILLED

191

1.1
Location : getPrimaries
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getPrimaries_returnsLiveResultsWhenCacheFails()]
replaced return value with Collections.emptyList for edu/ucsb/cs156/courses/services/UCSBCurriculumService::getPrimaries → KILLED

196

1.1
Location : getJSONByGE
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getJSONByGE()]
removed call to org/springframework/http/HttpHeaders::setAccept → KILLED

197

1.1
Location : getJSONByGE
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getJSONByGE()]
removed call to org/springframework/http/HttpHeaders::setContentType → KILLED

198

1.1
Location : getJSONByGE
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getJSONByGE()]
removed call to org/springframework/http/HttpHeaders::set → KILLED

199

1.1
Location : getJSONByGE
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getJSONByGE()]
removed call to org/springframework/http/HttpHeaders::set → KILLED

220

1.1
Location : getJSONByGE
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getJSONByGE()]
replaced return value with "" for edu/ucsb/cs156/courses/services/UCSBCurriculumService::getJSONByGE → KILLED

227

1.1
Location : getPrimariesByGE
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getPrimariesGE()]
replaced return value with Collections.emptyList for edu/ucsb/cs156/courses/services/UCSBCurriculumService::getPrimariesByGE → KILLED

236

1.1
Location : getSectionJSON
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getSectionJSON()]
replaced return value with "" for edu/ucsb/cs156/courses/services/UCSBCurriculumService::getSectionJSON → KILLED

242

1.1
Location : getSubjectsJSON
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getSubjectsJSON_success()]
removed call to org/springframework/http/HttpHeaders::setAccept → KILLED

243

1.1
Location : getSubjectsJSON
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getSubjectsJSON_success()]
removed call to org/springframework/http/HttpHeaders::setContentType → KILLED

244

1.1
Location : getSubjectsJSON
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getSubjectsJSON_success()]
removed call to org/springframework/http/HttpHeaders::set → KILLED

245

1.1
Location : getSubjectsJSON
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getSubjectsJSON_success()]
removed call to org/springframework/http/HttpHeaders::set → KILLED

263

1.1
Location : getSubjectsJSON
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getSubjectsJSON_success()]
replaced return value with "" for edu/ucsb/cs156/courses/services/UCSBCurriculumService::getSubjectsJSON → KILLED

273

1.1
Location : getSection
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getSection_not_found()]
removed call to org/springframework/http/HttpHeaders::setAccept → KILLED

274

1.1
Location : getSection
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getSection_not_found()]
removed call to org/springframework/http/HttpHeaders::setContentType → KILLED

275

1.1
Location : getSection
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getSection_not_found()]
removed call to org/springframework/http/HttpHeaders::set → KILLED

276

1.1
Location : getSection
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getSection_not_found()]
removed call to org/springframework/http/HttpHeaders::set → KILLED

298

1.1
Location : getSection
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getSection_not_found()]
negated conditional → KILLED

303

1.1
Location : getSection
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getSection_not_found()]
replaced return value with "" for edu/ucsb/cs156/courses/services/UCSBCurriculumService::getSection → KILLED

314

1.1
Location : getAllSections
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getAllSections_success()]
removed call to org/springframework/http/HttpHeaders::setAccept → KILLED

315

1.1
Location : getAllSections
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getAllSections_success()]
removed call to org/springframework/http/HttpHeaders::setContentType → KILLED

316

1.1
Location : getAllSections
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getAllSections_success()]
removed call to org/springframework/http/HttpHeaders::set → KILLED

317

1.1
Location : getAllSections
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getAllSections_success()]
removed call to org/springframework/http/HttpHeaders::set → KILLED

339

1.1
Location : getAllSections
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getAllSections_success()]
negated conditional → KILLED

344

1.1
Location : getAllSections
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getAllSections_success()]
replaced return value with "" for edu/ucsb/cs156/courses/services/UCSBCurriculumService::getAllSections → KILLED

350

1.1
Location : getJSONbyQtrEnrollCd
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getJSONbyQtrEnrollCd_success()]
removed call to org/springframework/http/HttpHeaders::setAccept → KILLED

351

1.1
Location : getJSONbyQtrEnrollCd
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getJSONbyQtrEnrollCd_success()]
removed call to org/springframework/http/HttpHeaders::setContentType → KILLED

352

1.1
Location : getJSONbyQtrEnrollCd
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getJSONbyQtrEnrollCd_success()]
removed call to org/springframework/http/HttpHeaders::set → KILLED

353

1.1
Location : getJSONbyQtrEnrollCd
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getJSONbyQtrEnrollCd_success()]
removed call to org/springframework/http/HttpHeaders::set → KILLED

372

1.1
Location : getJSONbyQtrEnrollCd
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getJSONbyQtrEnrollCd_success()]
replaced return value with "" for edu/ucsb/cs156/courses/services/UCSBCurriculumService::getJSONbyQtrEnrollCd → KILLED

377

1.1
Location : getFinalsInfo
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getFinalsInfo_success()]
removed call to org/springframework/http/HttpHeaders::setAccept → KILLED

378

1.1
Location : getFinalsInfo
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getFinalsInfo_success()]
removed call to org/springframework/http/HttpHeaders::set → KILLED

379

1.1
Location : getFinalsInfo
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getFinalsInfo_success()]
removed call to org/springframework/http/HttpHeaders::set → KILLED

398

1.1
Location : getFinalsInfo
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getFinalsInfo_success()]
replaced return value with "" for edu/ucsb/cs156/courses/services/UCSBCurriculumService::getFinalsInfo → KILLED

403

1.1
Location : getGeneralEducationInfo
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getGeneralEducationInfo_success()]
removed call to org/springframework/http/HttpHeaders::setAccept → KILLED

404

1.1
Location : getGeneralEducationInfo
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getGeneralEducationInfo_success()]
removed call to org/springframework/http/HttpHeaders::setContentType → KILLED

405

1.1
Location : getGeneralEducationInfo
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getGeneralEducationInfo_success()]
removed call to org/springframework/http/HttpHeaders::set → KILLED

406

1.1
Location : getGeneralEducationInfo
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getGeneralEducationInfo_success()]
removed call to org/springframework/http/HttpHeaders::set → KILLED

417

1.1
Location : getGeneralEducationInfo
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getGeneralEducationInfo_success()]
replaced return value with "" for edu/ucsb/cs156/courses/services/UCSBCurriculumService::getGeneralEducationInfo → KILLED

426

1.1
Location : getRequirementCodesByCollege
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getRequirementCodesByCollege_filtersAndDistinct()]
replaced return value with Collections.emptyList for edu/ucsb/cs156/courses/services/UCSBCurriculumService::getRequirementCodesByCollege → KILLED

427

1.1
Location : lambda$getRequirementCodesByCollege$0
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getRequirementCodesByCollege_filtersAndDistinct()]
replaced boolean return with false for edu/ucsb/cs156/courses/services/UCSBCurriculumService::lambda$getRequirementCodesByCollege$0 → KILLED

2.2
Location : lambda$getRequirementCodesByCollege$0
Killed by : edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBCurriculumServiceTests]/[method:test_getRequirementCodesByCollege_filtersAndDistinct()]
replaced boolean return with true for edu/ucsb/cs156/courses/services/UCSBCurriculumService::lambda$getRequirementCodesByCollege$0 → KILLED

Active mutators

Tests examined


Report generated by PIT 1.22.1