SystemInfoServiceImpl.java

1
package edu.ucsb.cs156.frontiers.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.frontiers.models.SystemInfo;
9
10
/**
11
 * This is a service for getting information about the system.
12
 * 
13
 * This class relies on property values. For hints on testing, see: <a href=
14
 * "https://www.baeldung.com/spring-boot-testing-configurationproperties">https://www.baeldung.com/spring-boot-testing-configurationproperties</a>
15
 * 
16
 */
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.oauth.login:/oauth2/authorization/google}")
30
  private String oauthLogin;
31
32
  @Value("${app.sourceRepo:https://github.com/ucsb-cs156/proj-courses}")
33
  private String sourceRepo;
34
35
  @Value("${git.commit.message.short:unknown}")
36
  private String commitMessage;
37
38
  @Value("${git.commit.id.abbrev:unknown}")
39
  private String commitId;
40
41
  public static String githubUrl(String repo, String commit) {
42 3 1. githubUrl : negated conditional → KILLED
2. githubUrl : negated conditional → KILLED
3. githubUrl : replaced return value with "" for edu/ucsb/cs156/frontiers/services/SystemInfoServiceImpl::githubUrl → KILLED
    return commit != null && repo != null ? repo + "/commit/" + commit : null;
43
  }
44
45
  /**
46
   * This method returns the system information.
47
   * 
48
   * @see edu.ucsb.cs156.frontiers.models.SystemInfo
49
   * @return the system information
50
   */
51
  public SystemInfo getSystemInfo() {
52
    SystemInfo si = SystemInfo.builder()
53
        .springH2ConsoleEnabled(this.springH2ConsoleEnabled)
54
        .showSwaggerUILink(this.showSwaggerUILink)
55
        .oauthLogin(this.oauthLogin)
56
        .sourceRepo(this.sourceRepo)
57
        .commitMessage(this.commitMessage)
58
        .commitId(this.commitId)
59
        .githubUrl(githubUrl(this.sourceRepo, this.commitId))
60
        .build();
61
    log.info("getSystemInfo returns {}", si);
62 1 1. getSystemInfo : replaced return value with null for edu/ucsb/cs156/frontiers/services/SystemInfoServiceImpl::getSystemInfo → KILLED
    return si;
63
  }
64
65
}

Mutations

42

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

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

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

62

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

Active mutators

Tests examined


Report generated by PIT 1.17.0