Refine search
/** * Returns a filtered stack trace */ public static String getFilteredTrace(Throwable t) { StringWriter stringWriter = new StringWriter(); PrintWriter writer = new PrintWriter(stringWriter); t.printStackTrace(writer); StringBuffer buffer = stringWriter.getBuffer(); String trace = buffer.toString(); return BaseTestRunner.getFilteredTrace(trace); }
clearStatus(); return null; testClass = loadSuiteClass(suiteClassName); } catch (ClassNotFoundException e) { String clazz = e.getMessage(); runFailed("Class not found \"" + clazz + "\""); return null; } catch (Exception e) { runFailed("Error: " + e.toString()); return null; clearStatus(); return new TestSuite(testClass); runFailed("Suite() method must be static"); return null; runFailed("Failed to invoke suite():" + e.getTargetException().toString()); return null; } catch (IllegalAccessException e) { runFailed("Failed to invoke suite():" + e.toString()); return null; clearStatus(); return test;
/** * Processes the command line arguments and * returns the name of the suite class to run or null */ protected String processArguments(String[] args) { String suiteName = null; for (int i = 0; i < args.length; i++) { if (args[i].equals("-noloading")) { setLoading(false); } else if (args[i].equals("-nofilterstack")) { fgFilterStack = false; } else if (args[i].equals("-c")) { if (args.length > i + 1) { suiteName = extractClassName(args[i + 1]); } else { System.out.println("Missing Test class name"); } i++; } else { suiteName = args[i]; } } return suiteName; }
public static void savePreferences() throws IOException { FileOutputStream fos = new FileOutputStream(getPreferencesFile()); try { getPreferences().store(fos, ""); } finally { fos.close(); } }
private static void readPreferences() { InputStream is = null; try { is = new FileInputStream(getPreferencesFile()); setPreferences(new Properties(getPreferences())); getPreferences().load(is); } catch (IOException ignored) { } catch (SecurityException ignored) { } finally { try { if (is != null) { is.close(); } } catch (IOException e1) { } } }
protected static Properties getPreferences() { if (fPreferences == null) { fPreferences = new Properties(); fPreferences.put("loading", "true"); fPreferences.put("filterstack", "true"); readPreferences(); } return fPreferences; }
public static String getPreference(String key) { return getPreferences().getProperty(key); }
public static void setPreference(String key, String value) { getPreferences().put(key, value); }
/** * Filters stack frames from internal JUnit classes */ public static String getFilteredTrace(String stack) { if (showStackRaw()) { return stack; } StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); StringReader sr = new StringReader(stack); BufferedReader br = new BufferedReader(sr); String line; try { while ((line = br.readLine()) != null) { if (!filterLine(line)) { pw.println(line); } } } catch (Exception IOException) { return stack; // return the stack unfiltered } return sw.toString(); }
public static void savePreferences() throws IOException { FileOutputStream fos= new FileOutputStream(getPreferencesFile()); try { // calling of the deprecated save method to enable compiling under 1.1.7 getPreferences().save(fos, ""); } finally { fos.close(); } }
public static int getPreference(String key, int dflt) { String value = getPreference(key); int intValue = dflt; if (value == null) { return intValue; } try { intValue = Integer.parseInt(value); } catch (NumberFormatException ne) { } return intValue; }
protected static Properties getPreferences() { if (fPreferences == null) { fPreferences = new Properties(); fPreferences.put("loading", "true"); fPreferences.put("filterstack", "true"); readPreferences(); } return fPreferences; }
private static void readPreferences() { InputStream is = null; try { is = new FileInputStream(getPreferencesFile()); setPreferences(new Properties(getPreferences())); getPreferences().load(is); } catch (IOException e) { try { if (is != null) { is.close(); } } catch (IOException e1) { } } }
public static String getPreference(String key) { return getPreferences().getProperty(key); }
public static void setPreference(String key, String value) { getPreferences().put(key, value); }
public static void savePreferences() throws IOException { FileOutputStream fos = new FileOutputStream(getPreferencesFile()); try { getPreferences().store(fos, ""); } finally { fos.close(); } }
/** * Filters stack frames from internal JUnit classes */ public static String getFilteredTrace(String stack) { if (showStackRaw()) { return stack; } StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); StringReader sr = new StringReader(stack); BufferedReader br = new BufferedReader(sr); String line; try { while ((line = br.readLine()) != null) { if (!filterLine(line)) { pw.println(line); } } } catch (Exception IOException) { return stack; // return the stack unfiltered } return sw.toString(); }
public static int getPreference(String key, int dflt) { String value = getPreference(key); int intValue = dflt; if (value == null) { return intValue; } try { intValue = Integer.parseInt(value); } catch (NumberFormatException ne) { } return intValue; }
protected static Properties getPreferences() { if (fPreferences == null) { fPreferences = new Properties(); fPreferences.put("loading", "true"); fPreferences.put("filterstack", "true"); readPreferences(); } return fPreferences; }
private static void readPreferences() { InputStream is = null; try { is = new FileInputStream(getPreferencesFile()); setPreferences(new Properties(getPreferences())); getPreferences().load(is); } catch (IOException e) { try { if (is != null) { is.close(); } } catch (IOException e1) { } } }