UCSBAPIQuarterService.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.entities.UCSBAPIQuarter;
6
import edu.ucsb.cs156.courses.models.Quarter;
7
import edu.ucsb.cs156.courses.repositories.UCSBAPIQuarterRepository;
8
import java.time.Duration;
9
import java.time.Instant;
10
import java.time.LocalDateTime;
11
import java.time.temporal.ChronoUnit;
12
import java.util.ArrayList;
13
import java.util.Arrays;
14
import java.util.List;
15
import lombok.extern.slf4j.Slf4j;
16
import org.springframework.beans.factory.annotation.Autowired;
17
import org.springframework.beans.factory.annotation.Value;
18
import org.springframework.boot.web.client.RestTemplateBuilder;
19
import org.springframework.http.HttpEntity;
20
import org.springframework.http.HttpHeaders;
21
import org.springframework.http.HttpMethod;
22
import org.springframework.http.HttpStatus;
23
import org.springframework.http.MediaType;
24
import org.springframework.http.ResponseEntity;
25
import org.springframework.stereotype.Service;
26
import org.springframework.web.client.RestTemplate;
27
28
/** Service object that wraps the UCSB Academic Curriculum API */
29
@Service
30
@Slf4j
31
public class UCSBAPIQuarterService {
32
33
  @Value("${app.startQtrYYYYQ:20221}")
34
  private String startQtrYYYYQ;
35
36
  @Autowired private ObjectMapper objectMapper;
37
38
  @Autowired UCSBAPIQuarterRepository ucsbApiQuarterRepository;
39
40
  @Value("${app.ucsb.api.consumer_key}")
41
  private String apiKey;
42
43
  @Value("${app.ucsb.api.host}")
44
  private String apiHost;
45
46
  private static final Duration CONNECT_TIMEOUT = Duration.ofSeconds(10);
47
  private static final Duration READ_TIMEOUT = Duration.ofSeconds(60);
48
49
  private RestTemplate restTemplate = new RestTemplate();
50
51
  public UCSBAPIQuarterService(RestTemplateBuilder restTemplateBuilder) throws Exception {
52
    restTemplate =
53
        restTemplateBuilder.connectTimeout(CONNECT_TIMEOUT).readTimeout(READ_TIMEOUT).build();
54
  }
55
56
  public static final String CURRENT_QUARTER_ENDPOINT =
57
      "{apiHost}/academics/quartercalendar/v1/quarters/current";
58
59
  public static final int CACHE_DURATION_HOURS = 24;
60
61
  private UCSBAPIQuarter cachedCurrentQuarter = null;
62
  private Instant cacheTime = null;
63
64
  void clearCurrentQuarterCache() {
65
    cachedCurrentQuarter = null;
66
    cacheTime = null;
67
  }
68
69
  void expireCurrentQuarterCache() {
70
    cacheTime = Instant.EPOCH;
71
  }
72
73
  public static final String ALL_QUARTERS_ENDPOINT =
74
      "{apiHost}/academics/quartercalendar/v1/quarters";
75
76
  public static final String END_QUARTER_ENDPOINT =
77
      "{apiHost}/academics/quartercalendar/v1/quarters/end";
78
79
  public String getStartQtrYYYYQ() {
80 1 1. getStartQtrYYYYQ : replaced return value with "" for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::getStartQtrYYYYQ → KILLED
    return startQtrYYYYQ;
81
  }
82
83
  public String getEndQtrYYYYQ() throws Exception {
84
    // Compute this each call so long-running servers pick up quarter rollovers without restart.
85 1 1. getEndQtrYYYYQ : replaced return value with "" for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::getEndQtrYYYYQ → KILLED
    return getEndQtrYYYYQ(getCurrentQuarterYYYYQ());
86
  }
87
88
  public String getEndQtrYYYYQ(String currentQuarterYYYYQ) {
89 1 1. getEndQtrYYYYQ : removed call to edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::validateCurrentQuarterYYYYQ → KILLED
    validateCurrentQuarterYYYYQ(currentQuarterYYYYQ);
90
    Quarter endQuarter = new Quarter(currentQuarterYYYYQ);
91 1 1. getEndQtrYYYYQ : negated conditional → KILLED
    int quartersToAdd = "S".equals(endQuarter.getQ()) ? 2 : 1;
92
93 2 1. getEndQtrYYYYQ : negated conditional → KILLED
2. getEndQtrYYYYQ : changed conditional boundary → KILLED
    for (int i = 0; i < quartersToAdd; i++) {
94
      endQuarter.increment();
95
    }
96
97 1 1. getEndQtrYYYYQ : replaced return value with "" for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::getEndQtrYYYYQ → KILLED
    return endQuarter.getYYYYQ();
98
  }
99
100
  public String getCurrentQuarterYYYYQ() throws Exception {
101
    UCSBAPIQuarter quarter = getCurrentQuarter();
102 1 1. getCurrentQuarterYYYYQ : negated conditional → KILLED
    if (quarter == null) {
103
      throw unableToComputeEndQtrException(null);
104
    }
105 1 1. getCurrentQuarterYYYYQ : replaced return value with "" for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::getCurrentQuarterYYYYQ → KILLED
    return quarter.getQuarter();
106
  }
107
108
  private void validateCurrentQuarterYYYYQ(String currentQuarterYYYYQ) {
109 1 1. validateCurrentQuarterYYYYQ : negated conditional → KILLED
    if (currentQuarterYYYYQ == null
110 1 1. validateCurrentQuarterYYYYQ : negated conditional → KILLED
        || currentQuarterYYYYQ.isBlank()
111 1 1. validateCurrentQuarterYYYYQ : negated conditional → KILLED
        || !currentQuarterYYYYQ.matches("\\d{5}")) {
112
      throw unableToComputeEndQtrException(currentQuarterYYYYQ);
113
    }
114
115
    try {
116
      Quarter.yyyyqToInt(currentQuarterYYYYQ);
117
    } catch (IllegalArgumentException e) {
118
      throw unableToComputeEndQtrException(currentQuarterYYYYQ);
119
    }
120
  }
121
122
  private IllegalStateException unableToComputeEndQtrException(String currentQuarterYYYYQ) {
123
    String valueForMessage =
124 1 1. unableToComputeEndQtrException : negated conditional → KILLED
        currentQuarterYYYYQ == null ? "null" : String.format("'%s'", currentQuarterYYYYQ);
125 1 1. unableToComputeEndQtrException : replaced return value with null for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::unableToComputeEndQtrException → KILLED
    return new IllegalStateException(
126
        String.format(
127
            "Unable to compute END_QTR: current quarter from UCSB API was null/invalid: %s",
128
            valueForMessage));
129
  }
130
131
  public List<String> getActiveQuarterList() throws Exception {
132
    String start = getCurrentQuarterYYYYQ();
133
    String end = getEndQtrYYYYQ(start);
134
135
    List<Quarter> quartersInOrder = Quarter.quarterList(start, end);
136
    List<String> result = new ArrayList<String>();
137
138
    for (Quarter quarter : quartersInOrder) {
139
      result.add(quarter.getYYYYQ());
140
    }
141
142 1 1. getActiveQuarterList : replaced return value with Collections.emptyList for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::getActiveQuarterList → KILLED
    return result;
143
  }
144
145
  public UCSBAPIQuarter getCurrentQuarter() throws Exception {
146 1 1. getCurrentQuarter : negated conditional → KILLED
    if (cachedCurrentQuarter != null
147 1 1. getCurrentQuarter : negated conditional → KILLED
        && Instant.now().isBefore(cacheTime.plus(CACHE_DURATION_HOURS, ChronoUnit.HOURS))) {
148 1 1. getCurrentQuarter : replaced return value with null for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::getCurrentQuarter → KILLED
      return cachedCurrentQuarter;
149
    }
150
151
    HttpHeaders headers = new HttpHeaders();
152 1 1. getCurrentQuarter : removed call to org/springframework/http/HttpHeaders::setAccept → KILLED
    headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON));
153 1 1. getCurrentQuarter : removed call to org/springframework/http/HttpHeaders::setContentType → KILLED
    headers.setContentType(MediaType.APPLICATION_JSON);
154 1 1. getCurrentQuarter : removed call to org/springframework/http/HttpHeaders::set → KILLED
    headers.set("ucsb-api-version", "1.0");
155 1 1. getCurrentQuarter : removed call to org/springframework/http/HttpHeaders::set → KILLED
    headers.set("ucsb-api-key", this.apiKey);
156
157
    HttpEntity<String> entity = new HttpEntity<>("body", headers);
158
159
    String url = CURRENT_QUARTER_ENDPOINT.replace("{apiHost}", apiHost);
160
161
    log.info("url=" + url);
162
163
    String retVal = "";
164
    MediaType contentType = null;
165
    HttpStatus statusCode = null;
166
167
    ResponseEntity<String> re = restTemplate.exchange(url, HttpMethod.GET, entity, String.class);
168
    contentType = re.getHeaders().getContentType();
169
    statusCode = (HttpStatus) re.getStatusCode();
170
    retVal = re.getBody();
171
172
    log.info("contentType: {} statusCode: {} entity: {}", contentType, statusCode, entity);
173
    log.trace("json: {}", retVal);
174
    UCSBAPIQuarter quarter = null;
175
    quarter = objectMapper.readValue(retVal, UCSBAPIQuarter.class);
176
    cachedCurrentQuarter = quarter;
177
    cacheTime = Instant.now();
178 1 1. getCurrentQuarter : replaced return value with null for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::getCurrentQuarter → KILLED
    return quarter;
179
  }
180
181
  public List<UCSBAPIQuarter> getAllQuarters() throws Exception {
182
    List<UCSBAPIQuarter> quarters = ucsbApiQuarterRepository.findAll();
183 1 1. getAllQuarters : negated conditional → KILLED
    if (quarters.isEmpty()) {
184
      quarters = this.loadAllQuarters();
185
    }
186 1 1. getAllQuarters : replaced return value with Collections.emptyList for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::getAllQuarters → KILLED
    return quarters;
187
  }
188
189
  public List<UCSBAPIQuarter> getAllQuartersFromAPI() throws Exception {
190
    HttpHeaders headers = new HttpHeaders();
191 1 1. getAllQuartersFromAPI : removed call to org/springframework/http/HttpHeaders::setAccept → KILLED
    headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON));
192 1 1. getAllQuartersFromAPI : removed call to org/springframework/http/HttpHeaders::setContentType → KILLED
    headers.setContentType(MediaType.APPLICATION_JSON);
193 1 1. getAllQuartersFromAPI : removed call to org/springframework/http/HttpHeaders::set → KILLED
    headers.set("ucsb-api-version", "1.0");
194 1 1. getAllQuartersFromAPI : removed call to org/springframework/http/HttpHeaders::set → KILLED
    headers.set("ucsb-api-key", this.apiKey);
195
196
    HttpEntity<String> entity = new HttpEntity<>("body", headers);
197
198
    String url = ALL_QUARTERS_ENDPOINT.replace("{apiHost}", apiHost);
199
200
    log.info("url=" + url);
201
202
    String retVal = "";
203
    MediaType contentType = null;
204
    HttpStatus statusCode = null;
205
206
    ResponseEntity<String> re = restTemplate.exchange(url, HttpMethod.GET, entity, String.class);
207
    contentType = re.getHeaders().getContentType();
208
    statusCode = (HttpStatus) re.getStatusCode();
209
    retVal = re.getBody();
210
211
    log.info(
212
        "json: {} contentType: {} statusCode: {} entity: {}",
213
        retVal,
214
        contentType,
215
        statusCode,
216
        entity);
217
    List<UCSBAPIQuarter> quarters = null;
218
    quarters = objectMapper.readValue(retVal, new TypeReference<List<UCSBAPIQuarter>>() {});
219 1 1. getAllQuartersFromAPI : replaced return value with Collections.emptyList for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::getAllQuartersFromAPI → KILLED
    return quarters;
220
  }
221
222
  public boolean quarterYYYYQInRange(String quarterYYYYQ) throws Exception {
223 2 1. quarterYYYYQInRange : replaced boolean return with true for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::quarterYYYYQInRange → KILLED
2. quarterYYYYQInRange : replaced boolean return with false for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::quarterYYYYQInRange → KILLED
    return quarterYYYYQInRange(quarterYYYYQ, getEndQtrYYYYQ());
224
  }
225
226
  boolean quarterYYYYQInRange(String quarterYYYYQ, String endQtrYYYYQ) {
227 2 1. quarterYYYYQInRange : negated conditional → KILLED
2. quarterYYYYQInRange : changed conditional boundary → KILLED
    boolean dateGEStart = quarterYYYYQ.compareTo(startQtrYYYYQ) >= 0;
228 2 1. quarterYYYYQInRange : negated conditional → KILLED
2. quarterYYYYQInRange : changed conditional boundary → KILLED
    boolean dateLEEnd = quarterYYYYQ.compareTo(endQtrYYYYQ) <= 0;
229 3 1. quarterYYYYQInRange : negated conditional → KILLED
2. quarterYYYYQInRange : negated conditional → KILLED
3. quarterYYYYQInRange : replaced boolean return with true for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::quarterYYYYQInRange → KILLED
    return (dateGEStart && dateLEEnd);
230
  }
231
232
  public List<UCSBAPIQuarter> loadAllQuarters() throws Exception {
233
    String endQtrYYYYQ = getEndQtrYYYYQ();
234
    List<UCSBAPIQuarter> quarters = this.getAllQuartersFromAPI();
235
    List<UCSBAPIQuarter> savedQuarters = new ArrayList<UCSBAPIQuarter>();
236 1 1. loadAllQuarters : removed call to java/util/List::forEach → KILLED
    quarters.forEach(
237
        (quarter) -> {
238 1 1. lambda$loadAllQuarters$0 : negated conditional → KILLED
          if (quarterYYYYQInRange(quarter.getQuarter(), endQtrYYYYQ)) {
239
            ucsbApiQuarterRepository.save(quarter);
240
            savedQuarters.add(quarter);
241
          }
242
        });
243
    log.info("savedQuarters.size={}", savedQuarters.size());
244 1 1. loadAllQuarters : replaced return value with Collections.emptyList for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::loadAllQuarters → KILLED
    return savedQuarters;
245
  }
246
247
  public List<String> getActiveQuarters() throws Exception {
248
    List<String> activeQuarters = new ArrayList<>();
249
    String currQtr = getCurrentQuarterYYYYQ();
250
    String endQtr = getEndQtrYYYYQ(currQtr);
251
252 2 1. getActiveQuarters : negated conditional → KILLED
2. getActiveQuarters : changed conditional boundary → KILLED
    if (currQtr.compareTo(endQtr) <= 0) {
253
      Quarter.quarterList(currQtr, endQtr)
254 1 1. getActiveQuarters : removed call to java/util/List::forEach → KILLED
          .forEach(quarter -> activeQuarters.add(quarter.getYYYYQ()));
255
    }
256
257 1 1. getActiveQuarters : replaced return value with Collections.emptyList for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::getActiveQuarters → KILLED
    return activeQuarters;
258
  }
259
260
  public LocalDateTime lastDayToRegister(UCSBAPIQuarter ucsbApiQuarter) {
261 1 1. lastDayToRegister : negated conditional → KILLED
    if (ucsbApiQuarter == null) {
262
      return null;
263
    }
264
265
    LocalDateTime lastDayToAddUndergrad = ucsbApiQuarter.getLastDayToAddUnderGrad();
266
    LocalDateTime lastDayToAddGrad = ucsbApiQuarter.getLastDayToAddGrad();
267
268 2 1. lastDayToRegister : negated conditional → KILLED
2. lastDayToRegister : negated conditional → KILLED
    if (lastDayToAddUndergrad == null || lastDayToAddGrad == null) {
269
      return null;
270
    }
271
272 2 1. lastDayToRegister : replaced return value with null for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::lastDayToRegister → KILLED
2. lastDayToRegister : negated conditional → KILLED
    return lastDayToAddUndergrad.isAfter(lastDayToAddGrad)
273
        ? lastDayToAddUndergrad
274
        : lastDayToAddGrad;
275
  }
276
277
  public boolean isQuarterInRegistrationPass(String quarterYYYYQ) {
278
    UCSBAPIQuarter quarter = ucsbApiQuarterRepository.findById(quarterYYYYQ).orElse(null);
279
    LocalDateTime lastDay = lastDayToRegister(quarter);
280
281 1 1. isQuarterInRegistrationPass : negated conditional → KILLED
    if (quarter == null) {
282 1 1. isQuarterInRegistrationPass : replaced boolean return with true for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::isQuarterInRegistrationPass → KILLED
      return false;
283
    }
284
285 1 1. isQuarterInRegistrationPass : negated conditional → KILLED
    if (lastDay == null) {
286 1 1. isQuarterInRegistrationPass : replaced boolean return with true for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::isQuarterInRegistrationPass → KILLED
      return false;
287
    }
288
289
    LocalDateTime pass1Begin = quarter.getPass1Begin();
290
291 1 1. isQuarterInRegistrationPass : negated conditional → KILLED
    if (pass1Begin == null) {
292 1 1. isQuarterInRegistrationPass : replaced boolean return with true for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::isQuarterInRegistrationPass → KILLED
      return false;
293
    }
294
295
    LocalDateTime currentDate = LocalDateTime.now();
296 3 1. isQuarterInRegistrationPass : negated conditional → KILLED
2. isQuarterInRegistrationPass : negated conditional → KILLED
3. isQuarterInRegistrationPass : replaced boolean return with true for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::isQuarterInRegistrationPass → KILLED
    return currentDate.isAfter(pass1Begin) && currentDate.isBefore(lastDay);
297
  }
298
299
  public List<String> getActiveRegistrationQuarters() throws Exception {
300
301
    List<String> activeQuarters = getActiveQuarters();
302
303
    List<String> registrationQuarters =
304 2 1. lambda$getActiveRegistrationQuarters$2 : replaced boolean return with false for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::lambda$getActiveRegistrationQuarters$2 → KILLED
2. lambda$getActiveRegistrationQuarters$2 : replaced boolean return with true for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::lambda$getActiveRegistrationQuarters$2 → KILLED
        activeQuarters.stream().filter(yyyyq -> isQuarterInRegistrationPass(yyyyq)).toList();
305 1 1. getActiveRegistrationQuarters : replaced return value with Collections.emptyList for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::getActiveRegistrationQuarters → KILLED
    return registrationQuarters;
306
  }
307
}

Mutations

80

1.1
Location : getStartQtrYYYYQ
Killed by : edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests]/[method:test_getStartQtrYYYYQ()]
replaced return value with "" for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::getStartQtrYYYYQ → KILLED

85

1.1
Location : getEndQtrYYYYQ
Killed by : edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests]/[method:test_getEndQtrYYYYQ_fromCurrentQuarterFall_rollsOverToWinterNextYear()]
replaced return value with "" for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::getEndQtrYYYYQ → KILLED

89

1.1
Location : getEndQtrYYYYQ
Killed by : edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests]/[method:test_getEndQtrYYYYQ_whenCurrentQuarterInputIsNull_throwsException()]
removed call to edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::validateCurrentQuarterYYYYQ → KILLED

91

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

93

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

2.2
Location : getEndQtrYYYYQ
Killed by : edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests]/[method:test_getEndQtrYYYYQ_whenCurrentQuarterIsFall_rollsOverToWinterNextYear()]
changed conditional boundary → KILLED

97

1.1
Location : getEndQtrYYYYQ
Killed by : edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests]/[method:test_getEndQtrYYYYQ_whenCurrentQuarterIsFall_rollsOverToWinterNextYear()]
replaced return value with "" for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::getEndQtrYYYYQ → KILLED

102

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

105

1.1
Location : getCurrentQuarterYYYYQ
Killed by : edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests]/[method:test_getCurrentQuarterYYYYQ()]
replaced return value with "" for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::getCurrentQuarterYYYYQ → KILLED

109

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

110

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

111

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

124

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

125

1.1
Location : unableToComputeEndQtrException
Killed by : edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests]/[method:test_getEndQtrYYYYQ_whenCurrentQuarterInputIsNull_throwsException()]
replaced return value with null for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::unableToComputeEndQtrException → KILLED

142

1.1
Location : getActiveQuarterList
Killed by : edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests]/[method:test_getActiveQuarterList()]
replaced return value with Collections.emptyList for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::getActiveQuarterList → KILLED

146

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

147

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

148

1.1
Location : getCurrentQuarter
Killed by : edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests]/[method:test_getCurrentQuarter_cached()]
replaced return value with null for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::getCurrentQuarter → KILLED

152

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

153

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

154

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

155

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

178

1.1
Location : getCurrentQuarter
Killed by : edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests]/[method:test_getCurrentQuarterYYYYQ()]
replaced return value with null for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::getCurrentQuarter → KILLED

183

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

186

1.1
Location : getAllQuarters
Killed by : edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests]/[method:test_getAllQuarters_preloaded()]
replaced return value with Collections.emptyList for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::getAllQuarters → KILLED

191

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

192

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

193

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

194

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

219

1.1
Location : getAllQuartersFromAPI
Killed by : edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests]/[method:test_getAllQuartersFromAPI()]
replaced return value with Collections.emptyList for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::getAllQuartersFromAPI → KILLED

223

1.1
Location : quarterYYYYQInRange
Killed by : edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests]/[method:test_quarterYYYYQInRange_withCurrentEndQuarter_20213_false()]
replaced boolean return with true for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::quarterYYYYQInRange → KILLED

2.2
Location : quarterYYYYQInRange
Killed by : edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests]/[method:test_quarterYYYYQInRange_withCurrentEndQuarter_20212_true()]
replaced boolean return with false for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::quarterYYYYQInRange → KILLED

227

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

2.2
Location : quarterYYYYQInRange
Killed by : edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests]/[method:test_quarterYYYYQInRange_20211_true()]
changed conditional boundary → KILLED

228

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

2.2
Location : quarterYYYYQInRange
Killed by : edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests]/[method:test_quarterYYYYQInRange_20223_true()]
changed conditional boundary → KILLED

229

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

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

3.3
Location : quarterYYYYQInRange
Killed by : edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests]/[method:test_quarterYYYYQInRange_20204_false()]
replaced boolean return with true for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::quarterYYYYQInRange → KILLED

236

1.1
Location : loadAllQuarters
Killed by : edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests]/[method:test_getAllQuarters_empty()]
removed call to java/util/List::forEach → KILLED

238

1.1
Location : lambda$loadAllQuarters$0
Killed by : edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests]/[method:test_getAllQuarters_empty()]
negated conditional → KILLED

244

1.1
Location : loadAllQuarters
Killed by : edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests]/[method:test_getAllQuarters_empty()]
replaced return value with Collections.emptyList for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::loadAllQuarters → KILLED

252

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

2.2
Location : getActiveQuarters
Killed by : edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests]/[method:test_getActiveQuarters_whenCurrentQuarterEqualsEndQuarter_returnsCurrentQuarter()]
changed conditional boundary → KILLED

254

1.1
Location : getActiveQuarters
Killed by : edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests]/[method:test_getActiveQuarters_whenCurrentQuarterEqualsEndQuarter_returnsCurrentQuarter()]
removed call to java/util/List::forEach → KILLED

257

1.1
Location : getActiveQuarters
Killed by : edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests]/[method:test_getActiveQuarters_whenCurrentQuarterEqualsEndQuarter_returnsCurrentQuarter()]
replaced return value with Collections.emptyList for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::getActiveQuarters → KILLED

261

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

268

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

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

272

1.1
Location : lastDayToRegister
Killed by : edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests]/[method:test_lastDayToRegister_Undergrad_Later()]
replaced return value with null for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::lastDayToRegister → KILLED

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

281

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

282

1.1
Location : isQuarterInRegistrationPass
Killed by : edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests]/[method:test_isQuarterRegistrationPass_findById_returns_null_then_false()]
replaced boolean return with true for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::isQuarterInRegistrationPass → KILLED

285

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

286

1.1
Location : isQuarterInRegistrationPass
Killed by : edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests]/[method:test_isQuarterRegistrationPass_findById_returns_quarter_with_null_values_then_false()]
replaced boolean return with true for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::isQuarterInRegistrationPass → KILLED

291

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

292

1.1
Location : isQuarterInRegistrationPass
Killed by : edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests]/[method:test_isQuarterRegistrationPass_findById_returns_quarter_with_pass1_null_returns_false()]
replaced boolean return with true for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::isQuarterInRegistrationPass → KILLED

296

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

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

3.3
Location : isQuarterInRegistrationPass
Killed by : edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests]/[method:test_isQuarterRegistrationPass_20211_findById_returns_object_with_good_values_but_date_before_pass1()]
replaced boolean return with true for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::isQuarterInRegistrationPass → KILLED

304

1.1
Location : lambda$getActiveRegistrationQuarters$2
Killed by : edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests]/[method:test_getActiveRegistrationQuarters()]
replaced boolean return with false for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::lambda$getActiveRegistrationQuarters$2 → KILLED

2.2
Location : lambda$getActiveRegistrationQuarters$2
Killed by : edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests]/[method:test_getActiveRegistrationQuarters()]
replaced boolean return with true for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::lambda$getActiveRegistrationQuarters$2 → KILLED

305

1.1
Location : getActiveRegistrationQuarters
Killed by : edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.courses.services.UCSBAPIQuarterServiceTests]/[method:test_getActiveRegistrationQuarters()]
replaced return value with Collections.emptyList for edu/ucsb/cs156/courses/services/UCSBAPIQuarterService::getActiveRegistrationQuarters → KILLED

Active mutators

Tests examined


Report generated by PIT 1.17.0