SystemInfoServiceImpl.java

1
package edu.ucsb.cs156.organic.services;
2
3
import lombok.extern.slf4j.Slf4j;
4
import org.springframework.beans.factory.annotation.Value;
5
import org.springframework.boot.context.properties.ConfigurationProperties;
6
import org.springframework.stereotype.Service;
7
8
import edu.ucsb.cs156.organic.models.SystemInfo;
9
10
// This class relies on property values
11
// For hints on testing, see: https://www.baeldung.com/spring-boot-testing-configurationproperties
12
13
@Slf4j
14
@Service("systemInfo")
15
@ConfigurationProperties
16
public class SystemInfoServiceImpl extends SystemInfoService {
17
18
  @Value("${spring.h2.console.enabled:false}")
19
  private boolean springH2ConsoleEnabled;
20
21
  @Value("${app.showSwaggerUILink:false}")
22
  private boolean showSwaggerUILink;
23
24
  @Value("${app.sourceRepo:https://github.com/ucsb-cs156/proj-courses}")
25
  private String sourceRepo;
26
27
  @Value("${git.commit.message.short:unknown}")
28
  private String commitMessage;
29
30
  @Value("${git.commit.id.abbrev:unknown}")
31
  private String commitId;
32
33
  public static String githubUrl(String repo, String commit) {
34 3 1. githubUrl : negated conditional → KILLED
2. githubUrl : negated conditional → KILLED
3. githubUrl : replaced return value with "" for edu/ucsb/cs156/organic/services/SystemInfoServiceImpl::githubUrl → KILLED
    return commit != null && repo != null ? repo + "/commit/" + commit : null;
35
  }
36
37
  public SystemInfo getSystemInfo() {
38
    SystemInfo si = SystemInfo.builder()
39
        .springH2ConsoleEnabled(this.springH2ConsoleEnabled)
40
        .showSwaggerUILink(this.showSwaggerUILink)
41
        .sourceRepo(this.sourceRepo)
42
        .commitMessage(this.commitMessage)
43
        .commitId(this.commitId)
44
        .githubUrl(githubUrl(this.sourceRepo, this.commitId))
45
        .build();
46
    log.info("getSystemInfo returns {}", si);
47 1 1. getSystemInfo : replaced return value with null for edu/ucsb/cs156/organic/services/SystemInfoServiceImpl::getSystemInfo → KILLED
    return si;
48
  }
49
50
}

Mutations

34

1.1
Location : githubUrl
Killed by : edu.ucsb.cs156.organic.services.SystemInfoServiceImplTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.organic.services.SystemInfoServiceImplTests]/[method:test_githubUrl()]
negated conditional → KILLED

2.2
Location : githubUrl
Killed by : edu.ucsb.cs156.organic.services.SystemInfoServiceImplTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.organic.services.SystemInfoServiceImplTests]/[method:test_githubUrl()]
negated conditional → KILLED

3.3
Location : githubUrl
Killed by : edu.ucsb.cs156.organic.services.SystemInfoServiceImplTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.organic.services.SystemInfoServiceImplTests]/[method:test_githubUrl()]
replaced return value with "" for edu/ucsb/cs156/organic/services/SystemInfoServiceImpl::githubUrl → KILLED

47

1.1
Location : getSystemInfo
Killed by : edu.ucsb.cs156.organic.services.SystemInfoServiceImplTests.[engine:junit-jupiter]/[class:edu.ucsb.cs156.organic.services.SystemInfoServiceImplTests]/[method:test_getSystemInfo()]
replaced return value with null for edu/ucsb/cs156/organic/services/SystemInfoServiceImpl::getSystemInfo → KILLED

Active mutators

Tests examined


Report generated by PIT 1.7.3