SystemInfoServiceImpl.java

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

Mutations

39

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

52

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