SystemInfoServiceImpl.java

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

Mutations

41

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

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

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

61

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

Active mutators

Tests examined


Report generated by PIT 1.17.0