Navigation Menu

Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
-more stable
-not modifying parameters (can lead to threading issues)
-using runtime exceptions for error handling
  • Loading branch information
hypery2k committed Mar 5, 2015
1 parent fc2fe2c commit 52ab689
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/main/java/net/mindengine/galen/GalenMain.java
Expand Up @@ -107,7 +107,7 @@ public void execute(GalenArguments arguments) throws Exception {
}
}

private void performPageDump(GalenArguments arguments) throws Exception {
private void performPageDump(GalenArguments arguments) throws SyntaxException {
SeleniumBrowserFactory browserFactory = new SeleniumBrowserFactory();
Browser browser = browserFactory.openBrowser();

Expand All @@ -132,7 +132,7 @@ private void performPageDump(GalenArguments arguments) throws Exception {
Galen.dumpPage(browser, arguments.getUrl(), arguments.getPaths().get(0), arguments.getExport(), arguments.getMaxWidth(), arguments.getMaxHeight());
System.out.println("Done!");
} catch (Exception ex) {
throw ex;
throw new RuntimeException(ex);
} finally {
browser.quit();
}
Expand Down Expand Up @@ -287,13 +287,13 @@ private void runTestsInThreads(final EventHandler eventHandler, List<GalenTest>

Pattern filterPattern = createTestFilter(arguments.getFilter());

tests = filterTests(tests, eventHandler);
List<GalenTest> filteredTests = filterTests(tests, eventHandler);

tellBeforeTestSuite(listener, tests);
tellBeforeTestSuite(listener, filteredTests);

List<GalenTestInfo> testInfos = Collections.synchronizedList(new LinkedList<GalenTestInfo>());

for (final GalenTest test : tests) {
for (final GalenTest test : filteredTests) {
if (matchesPattern(test.getName(), filterPattern) && matchesSelectedGroups(test, arguments.getGroups())) {
executor.execute(new TestRunnable(test, listener, eventHandler, testInfos));
}
Expand Down Expand Up @@ -337,8 +337,9 @@ private List<GalenTest> filterTests(List<GalenTest> tests, EventHandler eventHan
}

return asList(arrTests);
} else {
return tests;
}
return tests;
}

private void tellBeforeTestSuite(CompleteListener listener, List<GalenTest> tests) {
Expand Down

0 comments on commit 52ab689

Please sign in to comment.