Sort & format some junit files.

Review by: jlabanca (desk)

git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@6943 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/junit/CompileStrategy.java b/user/src/com/google/gwt/junit/CompileStrategy.java
index b1417e9..fb2d404 100644
--- a/user/src/com/google/gwt/junit/CompileStrategy.java
+++ b/user/src/com/google/gwt/junit/CompileStrategy.java
@@ -197,6 +197,12 @@
 class ParallelCompileStrategy extends PreCompileStrategy {
 
   /**
+   * The {@link BatchingStrategy} used to compile, which is set on the first
+   * compilation and is the same across all compilations.
+   */
+  private BatchingStrategy batchingStrategy;
+
+  /**
    * The list of all synthetic module names to be compiled.
    */
   private List<String> modulesToCompile = new ArrayList<String>();
@@ -208,12 +214,6 @@
   private RunStyle runStyle;
 
   /**
-   * The {@link BatchingStrategy} used to compile, which is set on the first
-   * compilation and is the same across all compilations.
-   */
-  private BatchingStrategy batchingStrategy;
-
-  /**
    * The {@link TreeLogger} used to compile, which is set on the first
    * compilation and is the same across all compilations.
    */
diff --git a/user/src/com/google/gwt/junit/JUnitMessageQueue.java b/user/src/com/google/gwt/junit/JUnitMessageQueue.java
index ddc8550..6e3fca4 100644
--- a/user/src/com/google/gwt/junit/JUnitMessageQueue.java
+++ b/user/src/com/google/gwt/junit/JUnitMessageQueue.java
@@ -48,9 +48,9 @@
    * Holds the state of an individual client.
    */
   public static class ClientStatus {
+    public int blockIndex = 0;
     public final String clientId;
     public boolean isNew = true;
-    public int blockIndex = 0;
 
     public ClientStatus(String clientId) {
       this.clientId = clientId;
@@ -70,11 +70,6 @@
    * Records results for each client; must lock before accessing.
    */
   private final Map<String, ClientStatus> clientStatuses = new HashMap<String, ClientStatus>();
-  
-  /**
-   * A set of the GWT user agents (eg. ie6, gecko) that have connected. 
-   */
-  private final Set<String> userAgents = new HashSet<String>();
 
   /**
    * The lock used to synchronize access to clientStatuses.
@@ -82,11 +77,22 @@
   private final Object clientStatusesLock = new Object();
 
   /**
+   * Set to true when the last test block has been added. This is used to tell
+   * clients that all tests are complete.
+   */
+  private boolean isLastTestBlockAvailable;
+
+  /**
    * The number of TestCase clients executing in parallel.
    */
   private int numClients = 1;
 
   /**
+   * The list of test blocks to run.
+   */
+  private final List<TestInfo[]> testBlocks = new ArrayList<TestInfo[]>();
+
+  /**
    * Maps the TestInfo to the results from each clientId. If JUnitResult is
    * null, it means that the client requested the test but did not report the
    * results yet.
@@ -94,22 +100,16 @@
   private final Map<TestInfo, Map<String, JUnitResult>> testResults = new HashMap<TestInfo, Map<String, JUnitResult>>();
 
   /**
-   * The list of test blocks to run.
+   * A set of the GWT user agents (eg. ie6, gecko) that have connected.
    */
-  private final List<TestInfo[]> testBlocks = new ArrayList<TestInfo[]>();
-
-  /**
-   * Set to true when the last test block has been added. This is used to tell
-   * clients that all tests are complete.
-   */
-  private boolean isLastTestBlockAvailable;
+  private final Set<String> userAgents = new HashSet<String>();
 
   /**
    * Only instantiable within this package.
    */
   JUnitMessageQueue() {
   }
-  
+
   /**
    * Called by the servlet to query for for the next block to test.
    * 
@@ -117,8 +117,8 @@
    * @param userAgent the user agent property of the client
    * @param blockIndex the index of the test block to get
    * @param timeout how long to wait for an answer
-   * @return the next test to run, or <code>null</code> if <code>timeout</code>
-   *         is exceeded or the next test does not match
+   * @return the next test to run, or <code>null</code> if
+   *         <code>timeout</code> is exceeded or the next test does not match
    *         <code>testClassName</code>
    */
   public TestBlock getTestBlock(String clientId, String userAgent,
@@ -457,7 +457,7 @@
   }
 
   /**
-   * Ensure that a {@link ClientStatus} for the clientId exists. 
+   * Ensure that a {@link ClientStatus} for the clientId exists.
    * 
    * @param clientId the id of the client
    * @return the {@link ClientStatus} for the client
@@ -487,7 +487,8 @@
     return results;
   }
 
-  private boolean isMember(Throwable exception, Set<Class<? extends Throwable>> throwableSet) {
+  private boolean isMember(Throwable exception,
+      Set<Class<? extends Throwable>> throwableSet) {
     for (Class<? extends Throwable> throwable : throwableSet) {
       if (throwable.isInstance(exception)) {
         return true;
diff --git a/user/src/com/google/gwt/junit/JUnitShell.java b/user/src/com/google/gwt/junit/JUnitShell.java
index 7c23420..5ead356 100644
--- a/user/src/com/google/gwt/junit/JUnitShell.java
+++ b/user/src/com/google/gwt/junit/JUnitShell.java
@@ -356,7 +356,7 @@
           return true;
         }
       });
-      
+
       registerHandler(new ArgHandlerInt() {
         @Override
         public String getPurpose() {
@@ -372,12 +372,12 @@
         public String[] getTagArgs() {
           return new String[] {"1"};
         }
-        
+
         @Override
         public boolean isRequired() {
           return false;
         }
-        
+
         @Override
         public boolean isUndocumented() {
           return false;
@@ -616,44 +616,35 @@
   }
 
   /**
-   * Determines how to batch up tests for execution.
-   */
-  private BatchingStrategy batchingStrategy = new NoBatchingStrategy();
-
-  /**
    * The amount of time to wait for all clients to complete a single test
-   * method, in milliseconds, measured from when the <i>last</i> client connects
-   * (and thus starts the test). Set by the -testMethodTimeout argument.
+   * method, in milliseconds, measured from when the <i>last</i> client
+   * connects (and thus starts the test). Set by the -testMethodTimeout
+   * argument.
    */
   private long baseTestMethodTimeoutMillis;
 
   /**
-   * Test method timeout as modified by the batching strategy.
+   * Determines how to batch up tests for execution.
    */
-  private long testBatchingMethodTimeoutMillis;
+  private BatchingStrategy batchingStrategy = new NoBatchingStrategy();
 
   /**
-   * Max number of times a test method must be tried. 
-   */
-  private int tries;
-  
-  /**
    * Determines how modules are compiled.
    */
   private CompileStrategy compileStrategy = new SimpleCompileStrategy(
       JUnitShell.this);
 
   /**
-   * Name of the module containing the current/last module to run.
-   */
-  private ModuleDef currentModule;
-
-  /**
    * A type oracle for the current module, used to validate class existence.
    */
   private CompilationState currentCompilationState;
 
   /**
+   * Name of the module containing the current/last module to run.
+   */
+  private ModuleDef currentModule;
+
+  /**
    * The name of the current test case being run.
    */
   private TestInfo currentTestInfo;
@@ -712,8 +703,8 @@
   private RunStyle runStyle = null;
 
   /**
-   * The argument passed to -runStyle.  This is parsed later so we can pass in
-   * a logger.
+   * The argument passed to -runStyle. This is parsed later so we can pass in a
+   * logger.
    */
   private String runStyleName = "HtmlUnit";
 
@@ -722,6 +713,11 @@
   private boolean standardsMode = false;
 
   /**
+   * Test method timeout as modified by the batching strategy.
+   */
+  private long testBatchingMethodTimeoutMillis;
+
+  /**
    * The time the test actually began.
    */
   private long testBeginTime;
@@ -741,6 +737,11 @@
   private long testMethodTimeout;
 
   /**
+   * Max number of times a test method must be tried.
+   */
+  private int tries;
+
+  /**
    * Enforce the singleton pattern. The call to {@link GWTShell}'s ctor forces
    * server mode and disables processing extra arguments as URLs to be shown.
    */
@@ -778,14 +779,16 @@
       // RunStyle already logged reasons for its failure
       return false;
     }
-    
+
     if (tries >= 1) {
       runStyle.setTries(tries);
     }
-    
+
     if (!runStyle.setupMode(getTopLogger(), developmentMode)) {
-      getTopLogger().log(TreeLogger.ERROR, "Run style does not support "
-          + (developmentMode ? "development" : "production") + " mode");
+      getTopLogger().log(
+          TreeLogger.ERROR,
+          "Run style does not support "
+              + (developmentMode ? "development" : "production") + " mode");
       return false;
     }
     return true;
@@ -828,16 +831,19 @@
         }
         userAgentList += remoteUserAgents[i];
       }
-      getTopLogger().log(TreeLogger.INFO,
+      getTopLogger().log(
+          TreeLogger.INFO,
           "All clients connected (Limiting future permutations to: "
-          + userAgentList + ")");
+              + userAgentList + ")");
     }
 
     long currentTimeMillis = System.currentTimeMillis();
     if (activeClients >= numClients) {
       if (activeClients > numClients) {
-        getTopLogger().log(TreeLogger.WARN, "Too many clients: expected "
-            + numClients + ", found " + activeClients);
+        getTopLogger().log(
+            TreeLogger.WARN,
+            "Too many clients: expected " + numClients + ", found "
+                + activeClients);
       }
       firstLaunch = false;
 
@@ -927,7 +933,7 @@
   /**
    * Accessor method to HostedModeBase.setHeadless -- without this, we get
    * IllegalAccessError from the -notHeadless arg handler. Compiler bug?
-   *
+   * 
    * @param headlessMode
    */
   void setHeadlessAccessor(boolean headlessMode) {
@@ -937,7 +943,8 @@
   /**
    * Set the expected number of clients.
    * 
-   * <p>Should only be called by RunStyle subtypes.
+   * <p>
+   * Should only be called by RunStyle subtypes.
    * 
    * @param numClients
    */
@@ -951,8 +958,10 @@
   }
 
   private void checkArgs() {
-    if (runStyle.getTries() > 1 && !(batchingStrategy instanceof NoBatchingStrategy)) {
-      throw new JUnitFatalLaunchException("Batching does not work with tries > 1");
+    if (runStyle.getTries() > 1
+        && !(batchingStrategy instanceof NoBatchingStrategy)) {
+      throw new JUnitFatalLaunchException(
+          "Batching does not work with tries > 1");
     }
   }
 
@@ -1073,8 +1082,8 @@
   /**
    * Runs a particular test case.
    */
-  private void runTestImpl(GWTTestCase testCase, TestResult testResult, int numTries)
-      throws UnableToCompleteException {
+  private void runTestImpl(GWTTestCase testCase, TestResult testResult,
+      int numTries) throws UnableToCompleteException {
 
     testBatchingMethodTimeoutMillis = batchingStrategy.getTimeoutMultiplier()
         * baseTestMethodTimeoutMillis;
diff --git a/user/src/com/google/gwt/junit/RunStyle.java b/user/src/com/google/gwt/junit/RunStyle.java
index e1cd227..d669294 100644
--- a/user/src/com/google/gwt/junit/RunStyle.java
+++ b/user/src/com/google/gwt/junit/RunStyle.java
@@ -26,16 +26,16 @@
  */
 abstract class RunStyle {
 
-  protected int tries = 1;
-  
   /**
    * The containing shell.
    */
   protected final JUnitShell shell;
 
+  protected int tries = 1;
+
   /**
-   * Constructor for RunStyle.  Any subclass must provide a constructor with
-   * the same signature since this will be how the RunStyle is created via
+   * Constructor for RunStyle. Any subclass must provide a constructor with the
+   * same signature since this will be how the RunStyle is created via
    * reflection.
    * 
    * @param shell the containing shell
@@ -57,7 +57,7 @@
    * Get the host name of the local system to use in URLs. This method returns
    * the host address instead of the host name in case the test target cannot
    * resolve the host name.
-   *  
+   * 
    * @return the host name of the local system
    */
   public String getLocalHostName() {
@@ -80,8 +80,8 @@
    * Initialize the runstyle with any supplied arguments.
    * 
    * @param args arguments passed in -runStyle option, null if none supplied
-   * @return true if this runstyle is initialized successfully, false if it
-   *     was unsuccessful
+   * @return true if this runstyle is initialized successfully, false if it was
+   *         unsuccessful
    */
   public boolean initialize(String args) {
     return true;
@@ -102,22 +102,22 @@
   }
 
   /**
-   * Setup this RunStyle for the selected mode. 
+   * Setup this RunStyle for the selected mode.
    * 
-   * @param logger TreeLogger to use for any messages 
-   * @param developmentMode true if we are running in development mode
-   *     rather that web/production mode
-   * @return false if we should abort processing due to an unsupported mode
-   *     or an error setting up for that mode
+   * @param logger TreeLogger to use for any messages
+   * @param developmentMode true if we are running in development mode rather
+   *          that web/production mode
+   * @return false if we should abort processing due to an unsupported mode or
+   *         an error setting up for that mode
    */
   public boolean setupMode(TreeLogger logger, boolean developmentMode) {
     return true;
   }
 
   /**
-   * Whether the embedded server should ever generate resources.  Hosted mode
-   * needs this, but not noserver hosted.  TODO(spoon) does web mode get
-   * simpler if this is turned on?
+   * Whether the embedded server should ever generate resources. Hosted mode
+   * needs this, but not noserver hosted. TODO(spoon) does web mode get simpler
+   * if this is turned on?
    */
   public boolean shouldAutoGenerateResources() {
     return true;
diff --git a/user/src/com/google/gwt/junit/RunStyleExternalBrowser.java b/user/src/com/google/gwt/junit/RunStyleExternalBrowser.java
index 12239ca..64246bc 100644
--- a/user/src/com/google/gwt/junit/RunStyleExternalBrowser.java
+++ b/user/src/com/google/gwt/junit/RunStyleExternalBrowser.java
@@ -68,7 +68,7 @@
   }
 
   private ExternalBrowser[] externalBrowsers;
-  
+
   /**
    * @param shell the containing shell
    */
@@ -99,9 +99,11 @@
   @Override
   public boolean initialize(String args) {
     if (args == null || args.length() == 0) {
-      getLogger().log(TreeLogger.ERROR, "ExternalBrowser runstyle requires an "
-          + "argument listing one or more executables of external browsers to "
-          + "launch");
+      getLogger().log(
+          TreeLogger.ERROR,
+          "ExternalBrowser runstyle requires an "
+              + "argument listing one or more executables of external browsers to "
+              + "launch");
       return false;
     }
     String browsers[] = args.split(",");
diff --git a/user/src/com/google/gwt/junit/RunStyleHtmlUnit.java b/user/src/com/google/gwt/junit/RunStyleHtmlUnit.java
index e4eff2c..4f94186 100644
--- a/user/src/com/google/gwt/junit/RunStyleHtmlUnit.java
+++ b/user/src/com/google/gwt/junit/RunStyleHtmlUnit.java
@@ -54,10 +54,10 @@
       IncorrectnessListener, OnbeforeunloadHandler {
 
     private final BrowserVersion browser;
+    private final boolean developmentMode;
+    private final TreeLogger treeLogger;
     private final String url;
     private Object waitForUnload = new Object();
-    private final TreeLogger treeLogger;
-    private final boolean developmentMode;
 
     public HtmlUnitThread(BrowserVersion browser, String url,
         TreeLogger treeLogger, boolean developmentMode) {
@@ -148,7 +148,7 @@
   }
 
   private static final Map<String, BrowserVersion> BROWSER_MAP = createBrowserMap();
-  
+
   /*
    * as long as this number is greater than 1, GWTTestCaseTest::testRetry will
    * pass
@@ -181,8 +181,8 @@
   }
 
   private Set<BrowserVersion> browsers = new HashSet<BrowserVersion>();
-  private final List<Thread> threads = new ArrayList<Thread>();
   private boolean developmentMode;
+  private final List<Thread> threads = new ArrayList<Thread>();
 
   /**
    * Create a RunStyle instance with the passed-in browser targets.
@@ -206,16 +206,17 @@
     for (String browserName : args.split(",")) {
       BrowserVersion browser = BROWSER_MAP.get(browserName);
       if (browser == null) {
-        getLogger().log(TreeLogger.ERROR, "RunStyleHtmlUnit: Unknown browser "
-            + "name " + browserName + ", expected browser name: one of "
-            + BROWSER_MAP.keySet());
+        getLogger().log(
+            TreeLogger.ERROR,
+            "RunStyleHtmlUnit: Unknown browser " + "name " + browserName
+                + ", expected browser name: one of " + BROWSER_MAP.keySet());
         return false;
       }
       browserSet.add(browser);
     }
     browsers = Collections.unmodifiableSet(browserSet);
-   
-    setTries(DEFAULT_TRIES); // set to the default value for this RunStyle 
+
+    setTries(DEFAULT_TRIES); // set to the default value for this RunStyle
     return true;
   }
 
diff --git a/user/src/com/google/gwt/junit/RunStyleManual.java b/user/src/com/google/gwt/junit/RunStyleManual.java
index 07e974a..c4b4de6 100644
--- a/user/src/com/google/gwt/junit/RunStyleManual.java
+++ b/user/src/com/google/gwt/junit/RunStyleManual.java
@@ -37,8 +37,8 @@
       try {
         numClients = Integer.parseInt(args);
       } catch (NumberFormatException e) {
-        getLogger().log(TreeLogger.ERROR, "Error parsing argument \""
-            + args + "\"", e);
+        getLogger().log(TreeLogger.ERROR,
+            "Error parsing argument \"" + args + "\"", e);
         return false;
       }
     }
diff --git a/user/src/com/google/gwt/junit/RunStyleRemoteWeb.java b/user/src/com/google/gwt/junit/RunStyleRemoteWeb.java
index e870a3a..90c7741 100644
--- a/user/src/com/google/gwt/junit/RunStyleRemoteWeb.java
+++ b/user/src/com/google/gwt/junit/RunStyleRemoteWeb.java
@@ -133,13 +133,13 @@
 
   private static final int RESPONSE_TIMEOUT_MS = 10000;
 
-  private RemoteBrowser[] remoteBrowsers;
-
   /**
    * The list of hosts that were interrupted.
    */
   private Set<String> interruptedHosts;
 
+  private RemoteBrowser[] remoteBrowsers;
+
   /**
    * A separate lock to control access to {@link #interruptedHosts}. This keeps
    * the main thread calls into {@link #getInterruptedHosts()} from having to
diff --git a/user/src/com/google/gwt/junit/RunStyleSelenium.java b/user/src/com/google/gwt/junit/RunStyleSelenium.java
index 31be8d7..7e3bfd2 100644
--- a/user/src/com/google/gwt/junit/RunStyleSelenium.java
+++ b/user/src/com/google/gwt/junit/RunStyleSelenium.java
@@ -35,7 +35,9 @@
    */
   protected static interface SeleniumWrapper {
     void createSelenium(String domain);
+
     Selenium getSelenium();
+
     String getSpecifier();
   }
 
@@ -44,8 +46,7 @@
    */
   static class RCSelenium implements SeleniumWrapper {
 
-    private static final Pattern PATTERN =
-        Pattern.compile("([\\w\\.-]+):([\\d]+)/(.+)");
+    private static final Pattern PATTERN = Pattern.compile("([\\w\\.-]+):([\\d]+)/(.+)");
 
     /*
      * Visible for testing.
@@ -86,13 +87,13 @@
     }
   }
 
-  private SeleniumWrapper remotes[];
-
   /**
    * The list of hosts that were interrupted.
    */
   private Set<String> interruptedHosts;
 
+  private SeleniumWrapper remotes[];
+
   /**
    * A separate lock to control access to {@link #interruptedHosts}. This keeps
    * the main thread calls into {@link #getInterruptedHosts()} from having to be
@@ -186,7 +187,7 @@
 
   /**
    * Factory method for {@link SeleniumWrapper}.
-   *
+   * 
    * @param seleniumSpecifier Specifies the Selenium instance to create
    * @return an instance of {@link SeleniumWrapper}
    */
diff --git a/user/test/com/google/gwt/junit/CompileStrategyTest.java b/user/test/com/google/gwt/junit/CompileStrategyTest.java
index df25b4a..ad644e0 100644
--- a/user/test/com/google/gwt/junit/CompileStrategyTest.java
+++ b/user/test/com/google/gwt/junit/CompileStrategyTest.java
@@ -34,79 +34,17 @@
 public class CompileStrategyTest extends TestCase {
 
   /**
-   * A mock {@link RunStyle} used for testing.
-   */
-  private static class MockRunStyle extends RunStyle {
-
-    public MockRunStyle() {
-      super(null);
-    }
-
-    @Override
-    public void launchModule(String moduleName) {
-    }
-  }
-
-  /**
-   * A mock {@link JUnitMessageQueue} used for testing.
-   */
-  private static class MockJUnitMessageQueue extends JUnitMessageQueue {
-
-    /**
-     * The test blocks added to the queue.
-     */
-    private List<TestInfo[]> testBlocks;
-
-    /**
-     * Indicates that this is the last test block.
-     */
-    private boolean isLastBlock;
-
-    public MockJUnitMessageQueue() {
-      super();
-    }
-
-    @Override
-    void addTestBlocks(List<TestInfo[]> newTestBlocks, boolean isLastBlock) {
-      assertNull(testBlocks);
-      this.testBlocks = newTestBlocks;
-      this.isLastBlock = isLastBlock;
-    }
-
-    void assertIsLastBlock(boolean expected) {
-      assertEquals(expected, isLastBlock);
-    }
-
-    void assertTestBlocks(List<TestInfo[]> expected) {
-      if (expected == null || testBlocks == null) {
-        assertEquals(expected, testBlocks);
-        return;
-      }
-
-      assertEquals(expected.size(), testBlocks.size());
-      for (int i = 0; i < testBlocks.size(); i++) {
-        TestInfo[] actualBlock = testBlocks.get(i);
-        TestInfo[] expectedBlock = expected.get(i);
-        assertEquals(expectedBlock.length, actualBlock.length);
-        for (int j = 0; j < expectedBlock.length; j++) {
-          assertEquals(expectedBlock[j], actualBlock[j]);
-        }
-      }
-    }
-  }
-
-  /**
    * A mock {@link CompileStrategy} used for testing.
    */
   private static class MockCompileStrategy extends CompileStrategy {
 
+    private MockJUnitMessageQueue messageQueue = new MockJUnitMessageQueue();
+
     /**
      * The number of modules to mock.
      */
     private int mockModuleCount;
 
-    private MockJUnitMessageQueue messageQueue = new MockJUnitMessageQueue();
-
     /**
      * Construct a new {@link MockCompileStrategy}.
      * 
@@ -167,6 +105,81 @@
     }
   }
 
+  /**
+   * A mock {@link JUnitMessageQueue} used for testing.
+   */
+  private static class MockJUnitMessageQueue extends JUnitMessageQueue {
+
+    /**
+   * Indicates that this is the last test block.
+   */
+    private boolean isLastBlock;
+
+    /**
+                         * The test blocks added to the queue.
+                         */
+    private List<TestInfo[]> testBlocks;
+
+    public MockJUnitMessageQueue() {
+      super();
+    }
+
+    @Override
+    void addTestBlocks(List<TestInfo[]> newTestBlocks, boolean isLastBlock) {
+      assertNull(testBlocks);
+      this.testBlocks = newTestBlocks;
+      this.isLastBlock = isLastBlock;
+    }
+
+    void assertIsLastBlock(boolean expected) {
+      assertEquals(expected, isLastBlock);
+    }
+
+    void assertTestBlocks(List<TestInfo[]> expected) {
+      if (expected == null || testBlocks == null) {
+        assertEquals(expected, testBlocks);
+        return;
+      }
+
+      assertEquals(expected.size(), testBlocks.size());
+      for (int i = 0; i < testBlocks.size(); i++) {
+        TestInfo[] actualBlock = testBlocks.get(i);
+        TestInfo[] expectedBlock = expected.get(i);
+        assertEquals(expectedBlock.length, actualBlock.length);
+        for (int j = 0; j < expectedBlock.length; j++) {
+          assertEquals(expectedBlock[j], actualBlock[j]);
+        }
+      }
+    }
+  }
+
+  /**
+ * A mock {@link RunStyle} used for testing.
+ */
+  private static class MockRunStyle extends RunStyle {
+
+    public MockRunStyle() {
+      super(null);
+    }
+
+    @Override
+    public void launchModule(String moduleName) {
+    }
+  }
+
+  public void testMaybeAddTestBlockForCurrentTestWithBatching() {
+    BatchingStrategy batchingStrategy = new ModuleBatchingStrategy();
+    assertFalse(batchingStrategy.isSingleTestOnly());
+
+    // Maybe add the current test.
+    GWTTestCase testCase = new MockGWTTestCase();
+    MockCompileStrategy strategy = new MockCompileStrategy(-1);
+    strategy.maybeAddTestBlockForCurrentTest(testCase, batchingStrategy);
+
+    // Verify the test is not added to the queue.
+    strategy.getMessageQueue().assertTestBlocks(null);
+  }
+
   public void testMaybeAddTestBlockForCurrentTestWithoutBatching() {
     BatchingStrategy batchingStrategy = new NoBatchingStrategy();
     assertTrue(batchingStrategy.isSingleTestOnly());
@@ -187,39 +200,6 @@
     strategy.getMessageQueue().assertTestBlocks(testBlocks);
   }
 
-  public void testMaybeAddTestBlockForCurrentTestWithBatching() {
-    BatchingStrategy batchingStrategy = new ModuleBatchingStrategy();
-    assertFalse(batchingStrategy.isSingleTestOnly());
-
-    // Maybe add the current test.
-    GWTTestCase testCase = new MockGWTTestCase();
-    MockCompileStrategy strategy = new MockCompileStrategy(-1);
-    strategy.maybeAddTestBlockForCurrentTest(testCase, batchingStrategy);
-
-    // Verify the test is not added to the queue.
-    strategy.getMessageQueue().assertTestBlocks(null);
-  }
-
-  public void testMaybeCompileModuleImplWithoutBatching() {
-    BatchingStrategy batchingStrategy = new NoBatchingStrategy();
-    assertTrue(batchingStrategy.isSingleTestOnly());
-
-    // Maybe add the current test.
-    RunStyle runStyle = new MockRunStyle();
-    GWTTestCase testCase = new MockGWTTestCase();
-    MockCompileStrategy strategy = new MockCompileStrategy(-1);
-    try {
-      strategy.maybeCompileModuleImpl(testCase.getModuleName(),
-          testCase.getSyntheticModuleName(), testCase.getStrategy(), runStyle,
-          batchingStrategy, TreeLogger.NULL);
-    } catch (UnableToCompleteException e) {
-      fail("Unexpected UnableToCompleteException: " + e.getMessage());
-    }
-
-    // Verify the test block is not added to the queue.
-    strategy.getMessageQueue().assertTestBlocks(null);
-  }
-
   public void testMaybeCompileModuleImplWithBatchingLastModule() {
     BatchingStrategy batchingStrategy = new ModuleBatchingStrategy();
     assertFalse(batchingStrategy.isSingleTestOnly());
@@ -263,4 +243,24 @@
     strategy.getMessageQueue().assertTestBlocks(
         batchingStrategy.getTestBlocks(testCase.getSyntheticModuleName()));
   }
+
+  public void testMaybeCompileModuleImplWithoutBatching() {
+    BatchingStrategy batchingStrategy = new NoBatchingStrategy();
+    assertTrue(batchingStrategy.isSingleTestOnly());
+
+    // Maybe add the current test.
+    RunStyle runStyle = new MockRunStyle();
+    GWTTestCase testCase = new MockGWTTestCase();
+    MockCompileStrategy strategy = new MockCompileStrategy(-1);
+    try {
+      strategy.maybeCompileModuleImpl(testCase.getModuleName(),
+          testCase.getSyntheticModuleName(), testCase.getStrategy(), runStyle,
+          batchingStrategy, TreeLogger.NULL);
+    } catch (UnableToCompleteException e) {
+      fail("Unexpected UnableToCompleteException: " + e.getMessage());
+    }
+
+    // Verify the test block is not added to the queue.
+    strategy.getMessageQueue().assertTestBlocks(null);
+  }
 }