@Test public void testStatus() { try { Prodigy.status(null); fail(); } catch (IllegalArgumentException e) { assertThat(e.getMessage(), is("Parameter 'id' is required")); } Scheduler scheduler = mock(Scheduler.class); doReturn(null).when(scheduler).get(anyString()); Prodigy.container(new Container(scheduler, mock(Repository.class))); try { Prodigy.status("fault-id-2"); fail(); } catch (IllegalArgumentException e) { assertThat(e.getMessage(), is("Fault id [fault-id-2] not found")); } scheduler = mock(Scheduler.class); Entry entry = new Entry("fault-id-2", "fault-2", "ACTIVE", "{}"); doReturn(entry).when(scheduler).get(anyString()); Prodigy.container(new Container(scheduler, mock(Repository.class))); assertSame(entry, Prodigy.status("fault-id-2")); scheduler = mock(Scheduler.class); List<Entry> entries = new ArrayList<>(); entry = new Entry("fault-id-1", "fault-1", "ACTIVE", "{}"); entries.add(entry); doReturn(entries).when(scheduler).list(); Prodigy.container(new Container(scheduler, mock(Repository.class))); assertSame(entries, Prodigy.status()); }
public static Entry status(String id) { if (id == null) { throw new IllegalArgumentException("Parameter 'id' is required"); } Entry entry = Prodigy.container().scheduler().get(id); if (entry == null) { throw new IllegalArgumentException("Fault id [" + id + "] not found"); } return entry; }
Prodigy { public static Entry status(String id) { if (id == null) { throw new IllegalArgumentException("Parameter 'id' is required"); } Entry entry = Prodigy.container().scheduler().get(id); if (entry == null) { throw new IllegalArgumentException("Fault id [" + id + "] not found"); } return entry; } }
Prodigy { public static Entry status(String id) { if (id == null) { throw new IllegalArgumentException("Parameter 'id' is required"); } Entry entry = Prodigy.container().scheduler().get(id); if (entry == null) { throw new IllegalArgumentException("Fault id [" + id + "] not found"); } return entry; } private  Prodigy(); }
Prodigy { public static Entry status(String id) { if (id == null) { throw new IllegalArgumentException("Parameter 'id' is required"); } Entry entry = Prodigy.container().scheduler().get(id); if (entry == null) { throw new IllegalArgumentException("Fault id [" + id + "] not found"); } return entry; } 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 Entry status(String id) { if (id == null) { throw new IllegalArgumentException("Parameter 'id' is required"); } Entry entry = Prodigy.container().scheduler().get(id); if (entry == null) { throw new IllegalArgumentException("Fault id [" + id + "] not found"); } return entry; } 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);  }