groovy git commit: minor refactoring

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

groovy git commit: minor refactoring

paulk
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_4_X 8a612adc6 -> e16728b91


minor refactoring


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/e16728b9
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/e16728b9
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/e16728b9

Branch: refs/heads/GROOVY_2_4_X
Commit: e16728b91601573ee18475ec5dee5355817f670c
Parents: 8a612ad
Author: Paul King <[hidden email]>
Authored: Fri Sep 14 16:25:37 2018 +1000
Committer: Paul King <[hidden email]>
Committed: Fri Sep 14 16:25:37 2018 +1000

----------------------------------------------------------------------
 .../org/codehaus/groovy/ant/GroovycTest.java     | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/e16728b9/subprojects/groovy-ant/src/test/groovy/org/codehaus/groovy/ant/GroovycTest.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-ant/src/test/groovy/org/codehaus/groovy/ant/GroovycTest.java b/subprojects/groovy-ant/src/test/groovy/org/codehaus/groovy/ant/GroovycTest.java
index e5c2fa8..ad19109 100644
--- a/subprojects/groovy-ant/src/test/groovy/org/codehaus/groovy/ant/GroovycTest.java
+++ b/subprojects/groovy-ant/src/test/groovy/org/codehaus/groovy/ant/GroovycTest.java
@@ -97,29 +97,30 @@ public class GroovycTest extends GroovyTestCase {
                 break;
             } catch (final FileNotFoundException fnfe) {
                 String message = "File " + result.getName() + " should have been created but wasn't.";
-                if (i == 0) {
-                    System.err.println(message);
-                    DefaultGroovyStaticMethods.sleep(this, 50L);
-                } else fail(message);
+                reportOrFail(i, message);
             } catch (final IOException ioe) {
                 String message = "Error reading file " + result.getName() + ".";
-                fail(message);
-                if (i == 0) System.err.println(message);
-                else fail(message);
+                reportOrFail(i, message);
             } finally {
                 if (null != fr) {
                     try {
                         fr.close();
                     } catch (IOException e) {
                         String message = "Error closing file reader: " + result.getName() + ".";
-                        if (i == 0) System.err.println(message);
-                        else fail(message);
+                        reportOrFail(i, message);
                     }
                 }
             }
         }
     }
 
+    private void reportOrFail(int i, String message) {
+        if (i == 0) {
+            System.err.println(message);
+            DefaultGroovyStaticMethods.sleep(this, 50L);
+        } else fail(message);
+    }
+
     public void testGroovycTest1_NoFork_NoClasspath() {
         ensureExecutes("GroovycTest1_NoFork_NoClasspath");
     }