Git.java

1
package com.github.dakusui.actionunit.actions.cmd.unix;
2
3
import com.github.dakusui.actionunit.actions.cmd.Commander;
4
import com.github.dakusui.actionunit.actions.cmd.CommanderFactory;
5
import com.github.dakusui.actionunit.actions.cmd.CommanderConfig;
6
import com.github.dakusui.actionunit.core.Context;
7
8
import java.util.function.Function;
9
import java.util.stream.Stream;
10
11
import static com.github.dakusui.actionunit.core.context.ContextFunctions.immediateOf;
12
import static java.util.Objects.requireNonNull;
13
14
public interface Git extends CommanderFactory {
15
  default LsRemote lsRemote() {
16 1 1. lsRemote : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git::lsRemote → KILLED
    return new LsRemote(config());
17
  }
18
19
  default Clone cloneRepo() {
20 1 1. cloneRepo : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git::cloneRepo → KILLED
    return new Clone(config());
21
  }
22
23
  default Checkout checkout() {
24 1 1. checkout : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git::checkout → KILLED
    return new Checkout(config());
25
  }
26
27
  default Push push() {
28 1 1. push : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git::push → KILLED
    return new Push(config());
29
  }
30
31
  default GitBase<Plain> plain() {
32 1 1. plain : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git::plain → KILLED
    return new Plain(config());
33
  }
34
35
  @Override
36
  default CommanderConfig config() {
37 1 1. config : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git::config → NO_COVERAGE
    return parent().config();
38
  }
39
40
  CommanderFactory parent();
41
42
  class Impl extends CommanderFactory.Base implements Git {
43
    protected Impl(CommanderConfig commanderConfig) {
44
      super(commanderConfig);
45
    }
46
47
    @Override
48
    public Git parent() {
49 1 1. parent : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git$Impl::parent → NO_COVERAGE
      return this;
50
    }
51
  }
52
53
  class Builder extends CommanderFactory.Builder<Builder, Git> {
54
55
    @Override
56
    protected Git createCommanderFactory(CommanderConfig config, Function<String, SshOptions> sshOptionsResolver) {
57 1 1. createCommanderFactory : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git$Builder::createCommanderFactory → KILLED
      return new Impl(config);
58
    }
59
  }
60
61
  class Clone extends GitBase<Clone> {
62
    @SuppressWarnings("WeakerAccess")
63
    public Clone(CommanderConfig config) {
64
      super(config);
65
      this.addOption("clone");
66
    }
67
68
    public Clone branch(String branchName) {
69 1 1. branch : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git$Clone::branch → KILLED
      return this.addOption("-b").add(branchName);
70
    }
71
72
    public Clone branch(Function<Context, String> branchName) {
73 1 1. branch : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git$Clone::branch → KILLED
      return this.addOption("-b").add(branchName);
74
    }
75
76
    public Clone repo(String repo) {
77 1 1. repo : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git$Clone::repo → KILLED
      return this.add(repo);
78
    }
79
80
    public Clone repo(Function<Context, String> repo) {
81 1 1. repo : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git$Clone::repo → KILLED
      return this.add(repo);
82
    }
83
  }
84
85
  class LsRemote extends GitBase<LsRemote> {
86
    @SuppressWarnings("WeakerAccess")
87
    public LsRemote(CommanderConfig config) {
88
      super(config);
89
      this.addOption("ls-remote");
90
    }
91
92
    public LsRemote repo(String repo) {
93 1 1. repo : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git$LsRemote::repo → KILLED
      return this.add(repo);
94
    }
95
96
    public LsRemote repo(Function<Context, String> repo) {
97 1 1. repo : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git$LsRemote::repo → KILLED
      return this.add(requireNonNull(repo));
98
    }
99
100
    public Function<Context, Stream<String>> remoteBranchNames() {
101 3 1. lambda$null$0 : replaced return value with "" for com/github/dakusui/actionunit/actions/cmd/unix/Git$LsRemote::lambda$null$0 → NO_COVERAGE
2. lambda$remoteBranchNames$1 : replaced return value with Stream.empty for com/github/dakusui/actionunit/actions/cmd/unix/Git$LsRemote::lambda$remoteBranchNames$1 → NO_COVERAGE
3. remoteBranchNames : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git$LsRemote::remoteBranchNames → NO_COVERAGE
      return c -> toStreamGenerator().apply(c).map(line -> line.trim().split("\\s+")[1]);
102
    }
103
  }
104
105
  class Checkout extends GitBase<Checkout> {
106
    @SuppressWarnings("WeakerAccess")
107
    public Checkout(CommanderConfig config) {
108
      super(config);
109
      this.addOption("checkout");
110
    }
111
112
    public Checkout branch(String branch) {
113 1 1. branch : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git$Checkout::branch → KILLED
      return this.add(branch);
114
    }
115
116
    public Checkout branch(Function<Context, String> branch) {
117 1 1. branch : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git$Checkout::branch → KILLED
      return this.add(branch);
118
    }
119
120
    public Checkout newBranch(String branch) {
121 1 1. newBranch : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git$Checkout::newBranch → KILLED
      return this.newBranch(immediateOf(branch));
122
    }
123
124
    public Checkout newBranch(Function<Context, String> branch) {
125 1 1. newBranch : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git$Checkout::newBranch → KILLED
      return this.addOption("-b").add(branch);
126
    }
127
  }
128
129
  class Push extends GitBase<Push> {
130
    @SuppressWarnings("WeakerAccess")
131
    public Push(CommanderConfig config) {
132
      super(config);
133
      this.addOption("push");
134
    }
135
136
    public Push repo(String repo) {
137 1 1. repo : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git$Push::repo → KILLED
      return add(repo);
138
    }
139
140
    public Push repo(Function<Context, String> repo) {
141 1 1. repo : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git$Push::repo → KILLED
      return this.add(repo);
142
    }
143
144
    public Push refspec(String spec) {
145 1 1. refspec : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git$Push::refspec → KILLED
      return add(spec);
146
    }
147
148
    public Push refspec(Function<Context, String> spec) {
149 1 1. refspec : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git$Push::refspec → KILLED
      return add(spec);
150
    }
151
  }
152
153
  class Plain extends GitBase<Plain> {
154
    @SuppressWarnings("WeakerAccess")
155
    public Plain(CommanderConfig config) {
156
      super(config);
157
    }
158
  }
159
160
  abstract class GitBase<C extends GitBase<C>> extends Commander<C> {
161
    @SuppressWarnings("WeakerAccess")
162
    public GitBase(CommanderConfig config) {
163
      super(config, "git");
164
    }
165
  }
166
}

Mutations

16

1.1
Location : lsRemote
Killed by : com.github.dakusui.actionunit.ut.actions.cmd.linux.GitTest$ForLsRemote.givenLsRemoteCommandUsingLiteral$whenFormatGitCloneCommand$thenProperlyFormatted(com.github.dakusui.actionunit.ut.actions.cmd.linux.GitTest$ForLsRemote)
replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git::lsRemote → KILLED

20

1.1
Location : cloneRepo
Killed by : com.github.dakusui.actionunit.ut.actions.cmd.linux.GitTest$ForClone.givenCloneCommandUsingContextFunctions$whenFormatGitCloneCommand$thenProperlyFormatted(com.github.dakusui.actionunit.ut.actions.cmd.linux.GitTest$ForClone)
replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git::cloneRepo → KILLED

24

1.1
Location : checkout
Killed by : com.github.dakusui.actionunit.ut.actions.cmd.linux.GitTest$ForCheckout.givenCheckoutCommandUsingLiteral$whenFormatGitCloneCommand$thenProperlyFormatted(com.github.dakusui.actionunit.ut.actions.cmd.linux.GitTest$ForCheckout)
replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git::checkout → KILLED

28

1.1
Location : push
Killed by : com.github.dakusui.actionunit.ut.actions.cmd.linux.GitTest$ForPush.givenRepoAndSpecWithFunction$whenFormat$thenCommandLineFormatIsCorrect(com.github.dakusui.actionunit.ut.actions.cmd.linux.GitTest$ForPush)
replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git::push → KILLED

32

1.1
Location : plain
Killed by : com.github.dakusui.actionunit.ut.actions.cmd.linux.GitTest$ForPlain.givenRepoAndSpecWithFunction$whenFormat$thenCommandLineFormatIsCorrect(com.github.dakusui.actionunit.ut.actions.cmd.linux.GitTest$ForPlain)
replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git::plain → KILLED

37

1.1
Location : config
Killed by : none
replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git::config → NO_COVERAGE

49

1.1
Location : parent
Killed by : none
replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git$Impl::parent → NO_COVERAGE

57

1.1
Location : createCommanderFactory
Killed by : com.github.dakusui.actionunit.ut.actions.cmd.linux.GitTest$ForCheckout.givenCheckoutCommandUsingLiteral$whenFormatGitCloneCommand$thenProperlyFormatted(com.github.dakusui.actionunit.ut.actions.cmd.linux.GitTest$ForCheckout)
replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git$Builder::createCommanderFactory → KILLED

69

1.1
Location : branch
Killed by : com.github.dakusui.actionunit.ut.actions.cmd.linux.GitTest$ForClone.givenCloneCommandUsingLiterals$whenFormatGitCloneCommand$thenProperlyFormatted(com.github.dakusui.actionunit.ut.actions.cmd.linux.GitTest$ForClone)
replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git$Clone::branch → KILLED

73

1.1
Location : branch
Killed by : com.github.dakusui.actionunit.ut.actions.cmd.linux.GitTest$ForClone.givenCloneCommandUsingContextFunctions$whenFormatGitCloneCommand$thenProperlyFormatted(com.github.dakusui.actionunit.ut.actions.cmd.linux.GitTest$ForClone)
replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git$Clone::branch → KILLED

77

1.1
Location : repo
Killed by : com.github.dakusui.actionunit.ut.actions.cmd.linux.GitTest$ForClone.givenCloneCommandUsingLiterals$whenFormatGitCloneCommand$thenProperlyFormatted(com.github.dakusui.actionunit.ut.actions.cmd.linux.GitTest$ForClone)
replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git$Clone::repo → KILLED

81

1.1
Location : repo
Killed by : com.github.dakusui.actionunit.ut.actions.cmd.linux.GitTest$ForClone.givenCloneCommandUsingContextFunctions$whenFormatGitCloneCommand$thenProperlyFormatted(com.github.dakusui.actionunit.ut.actions.cmd.linux.GitTest$ForClone)
replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git$Clone::repo → KILLED

93

1.1
Location : repo
Killed by : com.github.dakusui.actionunit.ut.actions.cmd.linux.GitTest$ForLsRemote.givenLsRemoteCommandUsingLiteral$whenFormatGitCloneCommand$thenProperlyFormatted(com.github.dakusui.actionunit.ut.actions.cmd.linux.GitTest$ForLsRemote)
replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git$LsRemote::repo → KILLED

97

1.1
Location : repo
Killed by : com.github.dakusui.actionunit.ut.actions.cmd.linux.GitTest$ForLsRemote.givenLsRemoteCommandUsingContextFunction$whenFormatGitCloneCommand$thenProperlyFormatted(com.github.dakusui.actionunit.ut.actions.cmd.linux.GitTest$ForLsRemote)
replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git$LsRemote::repo → KILLED

101

1.1
Location : lambda$null$0
Killed by : none
replaced return value with "" for com/github/dakusui/actionunit/actions/cmd/unix/Git$LsRemote::lambda$null$0 → NO_COVERAGE

2.2
Location : lambda$remoteBranchNames$1
Killed by : none
replaced return value with Stream.empty for com/github/dakusui/actionunit/actions/cmd/unix/Git$LsRemote::lambda$remoteBranchNames$1 → NO_COVERAGE

3.3
Location : remoteBranchNames
Killed by : none
replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git$LsRemote::remoteBranchNames → NO_COVERAGE

113

1.1
Location : branch
Killed by : com.github.dakusui.actionunit.ut.actions.cmd.linux.GitTest$ForCheckout.givenCheckoutCommandUsingLiteral$whenFormatGitCloneCommand$thenProperlyFormatted(com.github.dakusui.actionunit.ut.actions.cmd.linux.GitTest$ForCheckout)
replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git$Checkout::branch → KILLED

117

1.1
Location : branch
Killed by : com.github.dakusui.actionunit.ut.actions.cmd.linux.GitTest$ForCheckout.givenCheckoutCommandUsingContextFunction$whenFormatGitCloneCommand$thenProperlyFormatted(com.github.dakusui.actionunit.ut.actions.cmd.linux.GitTest$ForCheckout)
replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git$Checkout::branch → KILLED

121

1.1
Location : newBranch
Killed by : com.github.dakusui.actionunit.ut.actions.cmd.linux.GitTest$ForCheckout.givenCheckoutNewBranchCommandUsingLiteral$whenFormatGitCloneCommand$thenProperlyFormatted(com.github.dakusui.actionunit.ut.actions.cmd.linux.GitTest$ForCheckout)
replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git$Checkout::newBranch → KILLED

125

1.1
Location : newBranch
Killed by : com.github.dakusui.actionunit.ut.actions.cmd.linux.GitTest$ForCheckout.givenCheckoutNewBranchCommandUsingLiteral$whenFormatGitCloneCommand$thenProperlyFormatted(com.github.dakusui.actionunit.ut.actions.cmd.linux.GitTest$ForCheckout)
replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git$Checkout::newBranch → KILLED

137

1.1
Location : repo
Killed by : com.github.dakusui.actionunit.ut.actions.cmd.linux.GitTest$ForPush.givenRepoAndSpecWithImmediate$whenFormat$thenCommandLineFormatIsCorrect(com.github.dakusui.actionunit.ut.actions.cmd.linux.GitTest$ForPush)
replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git$Push::repo → KILLED

141

1.1
Location : repo
Killed by : com.github.dakusui.actionunit.ut.actions.cmd.linux.GitTest$ForPush.givenRepoAndSpecWithFunction$whenFormat$thenCommandLineFormatIsCorrect(com.github.dakusui.actionunit.ut.actions.cmd.linux.GitTest$ForPush)
replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git$Push::repo → KILLED

145

1.1
Location : refspec
Killed by : com.github.dakusui.actionunit.ut.actions.cmd.linux.GitTest$ForPush.givenRepoAndSpecWithImmediate$whenFormat$thenCommandLineFormatIsCorrect(com.github.dakusui.actionunit.ut.actions.cmd.linux.GitTest$ForPush)
replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git$Push::refspec → KILLED

149

1.1
Location : refspec
Killed by : com.github.dakusui.actionunit.ut.actions.cmd.linux.GitTest$ForPush.givenRepoAndSpecWithFunction$whenFormat$thenCommandLineFormatIsCorrect(com.github.dakusui.actionunit.ut.actions.cmd.linux.GitTest$ForPush)
replaced return value with null for com/github/dakusui/actionunit/actions/cmd/unix/Git$Push::refspec → KILLED

Active mutators

Tests examined


Report generated by PIT 1.7.3