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 | * <p>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 | @Slf4j | |
16 | @Service("systemInfo") | |
17 | @ConfigurationProperties | |
18 | public class SystemInfoServiceImpl extends SystemInfoService { | |
19 | ||
20 | @Value("${spring.h2.console.enabled:false}") | |
21 | private boolean springH2ConsoleEnabled; | |
22 | ||
23 | @Value("${app.showSwaggerUILink:false}") | |
24 | private boolean showSwaggerUILink; | |
25 | ||
26 | @Value("${app.oauth.login:/oauth2/authorization/google}") | |
27 | private String oauthLogin; | |
28 | ||
29 | @Value("${app.sourceRepo:https://github.com/ucsb-cs156/proj-courses}") | |
30 | private String sourceRepo; | |
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/example/services/SystemInfoServiceImpl::githubUrl → KILLED |
return commit != null && repo != null ? repo + "/commit/" + commit : null; |
40 | } | |
41 | ||
42 | /** | |
43 | * This method returns the system information. | |
44 | * | |
45 | * @see edu.ucsb.cs156.example.models.SystemInfo | |
46 | * @return the system information | |
47 | */ | |
48 | public SystemInfo getSystemInfo() { | |
49 | SystemInfo si = | |
50 | SystemInfo.builder() | |
51 | .springH2ConsoleEnabled(this.springH2ConsoleEnabled) | |
52 | .showSwaggerUILink(this.showSwaggerUILink) | |
53 | .oauthLogin(this.oauthLogin) | |
54 | .sourceRepo(this.sourceRepo) | |
55 | .commitMessage(this.commitMessage) | |
56 | .commitId(this.commitId) | |
57 | .githubUrl(githubUrl(this.sourceRepo, this.commitId)) | |
58 | .build(); | |
59 | log.info("getSystemInfo returns {}", si); | |
60 |
1
1. getSystemInfo : replaced return value with null for edu/ucsb/cs156/example/services/SystemInfoServiceImpl::getSystemInfo → KILLED |
return si; |
61 | } | |
62 | } | |
Mutations | ||
39 |
1.1 2.2 3.3 |
|
60 |
1.1 |