@Test void testDuplicateLoad() { String args[] = new String[0]; this.cmaService.load(args, this.logger::info); Assertions.assertThrows(IllegalStateException.class, () -> this.cmaService.load(args, this.logger::info)); }
public void load(String[] args, Consumer<String> output) { if (this.flags != null) throw new IllegalStateException("Already loaded."); this.flags = new EnumMap<>(Flag.class); this.outputFunction = output; processArgs(args); if (this.shouldProgramContinue()) { output("This is Amy. Copyright (c) 2018 the Amy project authors. For help run with flag -h."); } }
CommandLineArgumentHandlerService { public void load(String[] args, Consumer<String> output) { if (this.flags != null) throw new IllegalStateException("Already loaded."); this.flags = new EnumMap<>(Flag.class); this.outputFunction = output; processArgs(args); if (this.shouldProgramContinue()) { output("This is Amy. Copyright (c) 2018 the Amy project authors. For help run with flag -h."); } } }
CommandLineArgumentHandlerService { public void load(String[] args, Consumer<String> output) { if (this.flags != null) throw new IllegalStateException("Already loaded."); this.flags = new EnumMap<>(Flag.class); this.outputFunction = output; processArgs(args); if (this.shouldProgramContinue()) { output("This is Amy. Copyright (c) 2018 the Amy project authors. For help run with flag -h."); } }  }
CommandLineArgumentHandlerService { public void load(String[] args, Consumer<String> output) { if (this.flags != null) throw new IllegalStateException("Already loaded."); this.flags = new EnumMap<>(Flag.class); this.outputFunction = output; processArgs(args); if (this.shouldProgramContinue()) { output("This is Amy. Copyright (c) 2018 the Amy project authors. For help run with flag -h."); } }  void load(String[] args, Consumer<String> output); boolean areFlagsValid(); boolean shouldProgramContinue(); CommandLineArgumentInfo getInfo(); }
CommandLineArgumentHandlerService { public void load(String[] args, Consumer<String> output) { if (this.flags != null) throw new IllegalStateException("Already loaded."); this.flags = new EnumMap<>(Flag.class); this.outputFunction = output; processArgs(args); if (this.shouldProgramContinue()) { output("This is Amy. Copyright (c) 2018 the Amy project authors. For help run with flag -h."); } }  void load(String[] args, Consumer<String> output); boolean areFlagsValid(); boolean shouldProgramContinue(); CommandLineArgumentInfo getInfo();  }