PresetSubcommand.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
6
import java.io.IOException;
7
import java.io.InputStream;
8
import java.io.PrintStream;
9
import java.lang.reflect.InvocationTargetException;
10
11
import static java.util.Objects.requireNonNull;
12
13
public enum PresetSubcommand implements Subcommand {
14
  VERSION(Version.class),
15
  HELP(Help.class),
16
  LIST(ListDevices.class),
17
  PLAY(Play.class),
18
  COMPILE(Compile.class),
19
  ROUTE(PatchBay.class);
20
  
21
  private final Class<? extends Subcommand> subcommandClass;
22
  
23
  PresetSubcommand(Class<? extends Subcommand> subcommandClass) {
24
    this.subcommandClass = requireNonNull(subcommandClass);
25
  }
26
  
27
  final public void invoke(Cli cli, PrintStream ps, InputStream inputStream) throws IOException {
28
    try {
29 1 1. invoke : removed call to com/github/dakusui/symfonion/cli/Subcommand::invoke → KILLED
      ((Subcommand) this.subcommandClass.getConstructors()[0].newInstance()).invoke(cli, ps, inputStream);
30
    } catch (InstantiationException | IllegalAccessException e) {
31
      throw new RuntimeException(e);
32
    } catch (InvocationTargetException e) {
33
      throw new RuntimeException(e.getCause());
34
    }
35
  }
36
}

Mutations

29

1.1
Location : invoke
Killed by : com.github.dakusui.symfonion.tests.MalformedTest.givenMalformed_brokenObject(com.github.dakusui.symfonion.tests.MalformedTest)
removed call to com/github/dakusui/symfonion/cli/Subcommand::invoke → KILLED

Active mutators

Tests examined


Report generated by PIT 1.15.3