Version.java

1
package com.github.dakusui.symfonion.cli.subcommands;
2
3
import com.github.dakusui.symfonion.cli.Cli;
4
import com.github.dakusui.symfonion.cli.Subcommand;
5
import com.github.dakusui.symfonion.exceptions.SymfonionException;
6
7
import java.io.IOException;
8
import java.io.InputStream;
9
import java.io.PrintStream;
10
import java.util.Properties;
11
12
public class Version implements Subcommand {
13
    public static String license() {
14 1 1. license : replaced return value with "" for com/github/dakusui/symfonion/cli/subcommands/Version::license → SURVIVED
      return """
15
          Copyright 2013 Hiroshi Ukai.
16
          
17
          Licensed under the Apache License, Version 2.0 (the "License");you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:
18
          
19
          https://www.apache.org/licenses/LICENSE-2.0
20
          
21
          Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.""";
22
    }
23
    
24
    public static String version() {
25
      String path = "/META-INF/maven/com.github.dakusui/symfonion/pom.properties";
26
      Properties props = new Properties();
27
      String version = "(N/A)";
28
      InputStream stream = Cli.class.getResourceAsStream(path);
29 1 1. version : negated conditional → KILLED
      if (stream != null) {
30
        try {
31 1 1. version : removed call to java/util/Properties::load → NO_COVERAGE
          props.load(stream);
32
          version = props.getProperty("version");
33
        } catch (IOException ignored) {
34
        }
35
      }
36 1 1. version : replaced return value with "" for com/github/dakusui/symfonion/cli/subcommands/Version::version → SURVIVED
      return version;
37
    }
38
    
39
    @Override
40
    public void invoke(Cli cli, PrintStream ps, InputStream inputStream) throws SymfonionException, IOException {
41 1 1. invoke : removed call to java/io/PrintStream::println → SURVIVED
        ps.println("SyMFONION " + version());
42 1 1. invoke : removed call to java/io/PrintStream::println → SURVIVED
        ps.println(license());
43
    }
44
}

Mutations

14

1.1
Location : license
Killed by : none
replaced return value with "" for com/github/dakusui/symfonion/cli/subcommands/Version::license → SURVIVED

29

1.1
Location : version
Killed by : com.github.dakusui.symfonion.tests.cli.subcommands.VersionTest.whenExecuteVersion_thenWorksFind(com.github.dakusui.symfonion.tests.cli.subcommands.VersionTest)
negated conditional → KILLED

31

1.1
Location : version
Killed by : none
removed call to java/util/Properties::load → NO_COVERAGE

36

1.1
Location : version
Killed by : none
replaced return value with "" for com/github/dakusui/symfonion/cli/subcommands/Version::version → SURVIVED

41

1.1
Location : invoke
Killed by : none
removed call to java/io/PrintStream::println → SURVIVED

42

1.1
Location : invoke
Killed by : none
removed call to java/io/PrintStream::println → SURVIVED

Active mutators

Tests examined


Report generated by PIT 1.15.3