### Question:
JUnitCore { Result runMain(JUnitSystem system, String... args) { system.out().println("JUnit version " + Version.id()); JUnitCommandLineParseResult jUnitCommandLineParseResult = JUnitCommandLineParseResult.parse(args); RunListener listener = new TextListener(system); addListener(listener); return run(jUnitCommandLineParseResult.createRequest(defaultComputer())); }  static void main(String... args); static Result runClasses(Class<?>... classes); static Result runClasses(Computer computer, Class<?>... classes); String getVersion(); Result run(Class<?>... classes); Result run(Computer computer, Class<?>... classes); Result run(Request request); Result run(junit.framework.Test test); Result run(Runner runner); void addListener(RunListener listener); void removeListener(RunListener listener);  }### Answer:
@Test public void shouldAddFailuresToResult() { JUnitCore jUnitCore = new JUnitCore(); Result result = jUnitCore.runMain(new TestSystem(), "NonExistentTest"); assertThat(result.getFailureCount(), is(1)); assertThat(result.getFailures().get(0).getException(), instanceOf(IllegalArgumentException.class)); }