CommanderFactoryManager.java

1
package com.github.dakusui.actionunit.actions.cmd;
2
3
import java.util.function.BiFunction;
4
import java.util.function.Function;
5
6
import static java.util.Objects.requireNonNull;
7
8
public interface CommanderFactoryManager<C extends CommanderFactory> {
9
  C local();
10
11
  C remote(String host);
12
13
  class Base<M extends CommanderFactoryManager<C>, C extends CommanderFactory>
14
      implements CommanderFactoryManager<C> {
15
    final private Function<M, C>           localCommanderFactory;
16
    final private BiFunction<M, String, C> remoteCommanderFactory;
17
18
    public Base(Function<M, C> localCommanderFactory, BiFunction<M, String, C> remoteCommanderFactory) {
19
      this.localCommanderFactory = localCommanderFactory;
20
      this.remoteCommanderFactory = remoteCommanderFactory;
21
    }
22
23
    @SuppressWarnings("unchecked")
24
    @Override
25
    public C local() {
26 1 1. local : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/CommanderFactoryManager$Base::local → NO_COVERAGE
      return this.localCommanderFactory.apply((M) this);
27
    }
28
29
    @SuppressWarnings("unchecked")
30
    @Override
31
    public C remote(String host) {
32 1 1. remote : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/CommanderFactoryManager$Base::remote → NO_COVERAGE
      return this.remoteCommanderFactory.apply((M) this, host);
33
    }
34
  }
35
36
  abstract class Builder<
37
      B extends Builder<B, M, C>,
38
      M extends CommanderFactoryManager<C>,
39
      C extends CommanderFactory> {
40
41
    private Function<M, C>           localCommanderFactory;
42
    private BiFunction<M, String, C> remoteCommanderFactory;
43
44
    @SuppressWarnings("unchecked")
45
    public B localCommanderFactory(Function<M, C> func) {
46
      this.localCommanderFactory = requireNonNull(func);
47 1 1. localCommanderFactory : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/CommanderFactoryManager$Builder::localCommanderFactory → NO_COVERAGE
      return (B) this;
48
    }
49
50
    @SuppressWarnings("unchecked")
51
    public B remoteCommanderFactory(BiFunction<M, String, C> func) {
52
      this.remoteCommanderFactory = requireNonNull(func);
53 1 1. remoteCommanderFactory : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/CommanderFactoryManager$Builder::remoteCommanderFactory → NO_COVERAGE
      return (B) this;
54
    }
55
56
    public M build() {
57 1 1. build : replaced return value with null for com/github/dakusui/actionunit/actions/cmd/CommanderFactoryManager$Builder::build → NO_COVERAGE
      return createCommanderFactoryManager(localCommanderFactory, remoteCommanderFactory);
58
    }
59
60
    abstract protected M createCommanderFactoryManager(
61
        Function<M, C> localCommanderFactory,
62
        BiFunction<M, String, C> remoteCommanderFactory);
63
  }
64
}

Mutations

26

1.1
Location : local
Killed by : none
replaced return value with null for com/github/dakusui/actionunit/actions/cmd/CommanderFactoryManager$Base::local → NO_COVERAGE

32

1.1
Location : remote
Killed by : none
replaced return value with null for com/github/dakusui/actionunit/actions/cmd/CommanderFactoryManager$Base::remote → NO_COVERAGE

47

1.1
Location : localCommanderFactory
Killed by : none
replaced return value with null for com/github/dakusui/actionunit/actions/cmd/CommanderFactoryManager$Builder::localCommanderFactory → NO_COVERAGE

53

1.1
Location : remoteCommanderFactory
Killed by : none
replaced return value with null for com/github/dakusui/actionunit/actions/cmd/CommanderFactoryManager$Builder::remoteCommanderFactory → NO_COVERAGE

57

1.1
Location : build
Killed by : none
replaced return value with null for com/github/dakusui/actionunit/actions/cmd/CommanderFactoryManager$Builder::build → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.7.3