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
  PLAY_SONG(PlaySong.class),
19
  COMPILE(CompatCompile.class),
20
  COMPILE_SONG(Compile.class),
21
  ROUTE(PatchBay.class);
22
  
23
  private final Class<? extends Subcommand> subcommandClass;
24
  
25
  PresetSubcommand(Class<? extends Subcommand> subcommandClass) {
26
    this.subcommandClass = requireNonNull(subcommandClass);
27
  }
28
  
29
  final public void invoke(Cli cli, PrintStream ps, InputStream inputStream) throws IOException {
30
    try {
31 1 1. invoke : removed call to com/github/dakusui/symfonion/cli/Subcommand::invoke → KILLED
      ((Subcommand) this.subcommandClass.getConstructors()[0].newInstance()).invoke(cli, ps, inputStream);
32
    } catch (InstantiationException | IllegalAccessException e) {
33
      throw new RuntimeException(e);
34
    } catch (InvocationTargetException e) {
35
      throw new RuntimeException(e.getCause());
36
    }
37
  }
38
}

Mutations

31

1.1
Location : invoke
Killed by : com.github.dakusui.symfonion.tests.MalformedTest.[engine:junit-jupiter]/[class:com.github.dakusui.symfonion.tests.MalformedTest]/[method:givenMalformed_emptyFile()]
removed call to com/github/dakusui/symfonion/cli/Subcommand::invoke → KILLED

Active mutators

Tests examined


Report generated by PIT 1.19.1