@Test public void testEject() { try { Prodigy.eject(null); fail(); } catch (IllegalArgumentException e) { assertThat(e.getMessage(), is("Parameter 'id' is required")); } Scheduler scheduler = mock(Scheduler.class); doReturn(false).when(scheduler).unschedule(anyString()); Prodigy.container(new Container(scheduler, mock(Repository.class))); try { Prodigy.eject("fault-id-1"); fail(); } catch (IllegalArgumentException e) { assertThat(e.getMessage(), is("Fault id [fault-id-1] not found")); } scheduler = mock(Scheduler.class); doReturn(true).when(scheduler).unschedule(anyString()); Prodigy.container(new Container(scheduler, mock(Repository.class))); Prodigy.eject("fault-id-2"); }
public static void eject(String id) { if (id == null) { throw new IllegalArgumentException("Parameter 'id' is required"); } log.info("Ejecting fault id [" + id + "]"); boolean result = container.scheduler().unschedule(id); if (!result) { throw new IllegalArgumentException("Fault id [" + id + "] not found"); } log.info("Fault id [" + id + "] ejected"); }
Prodigy { public static void eject(String id) { if (id == null) { throw new IllegalArgumentException("Parameter 'id' is required"); } log.info("Ejecting fault id [" + id + "]"); boolean result = container.scheduler().unschedule(id); if (!result) { throw new IllegalArgumentException("Fault id [" + id + "] not found"); } log.info("Fault id [" + id + "] ejected"); } }
Prodigy { public static void eject(String id) { if (id == null) { throw new IllegalArgumentException("Parameter 'id' is required"); } log.info("Ejecting fault id [" + id + "]"); boolean result = container.scheduler().unschedule(id); if (!result) { throw new IllegalArgumentException("Fault id [" + id + "] not found"); } log.info("Fault id [" + id + "] ejected"); } private  Prodigy(); }
Prodigy { public static void eject(String id) { if (id == null) { throw new IllegalArgumentException("Parameter 'id' is required"); } log.info("Ejecting fault id [" + id + "]"); boolean result = container.scheduler().unschedule(id); if (!result) { throw new IllegalArgumentException("Fault id [" + id + "] not found"); } log.info("Fault id [" + id + "] ejected"); } private  Prodigy(); @SuppressWarnings("unchecked") static T adapt(T target); static String inject(String name, String params); static void eject(String id); static Map<String, Class<? extends Fault>> faults(); static Entry status(String id); static List<Entry> status(); static void push(String name, InputStream jar); }
Prodigy { public static void eject(String id) { if (id == null) { throw new IllegalArgumentException("Parameter 'id' is required"); } log.info("Ejecting fault id [" + id + "]"); boolean result = container.scheduler().unschedule(id); if (!result) { throw new IllegalArgumentException("Fault id [" + id + "] not found"); } log.info("Fault id [" + id + "] ejected"); } private  Prodigy(); @SuppressWarnings("unchecked") static T adapt(T target); static String inject(String name, String params); static void eject(String id); static Map<String, Class<? extends Fault>> faults(); static Entry status(String id); static List<Entry> status(); static void push(String name, InputStream jar);  }