refactory whole plugin
[phpeclipse.git] / net.sourceforge.phpeclipse.phpunit / src / net / sourceforge / phpeclipse / phpunit / testpool / TestPool.java
index 8e6a7fb..ddd0422 100644 (file)
@@ -6,79 +6,75 @@
  * 
  *************************************************************************/
 
-
 package net.sourceforge.phpeclipse.phpunit.testpool;
 
 import java.util.HashMap;
 
 public class TestPool {
 
-       //private TestSuite currentParentTestSuite;
+       // private TestSuite currentParentTestSuite;
        private HashMap tests;
+
        private TestSuite root;
+
        private TestSuite currentTestSuite;
-       
-       
+
        /**
         * 
         */
        public TestPool(String rootTitle) {
-               
+
                tests = new HashMap();
-               root = null;            
+               root = null;
                currentTestSuite = root;
-               
+
        }
 
        /**
         * @param test
         */
        public void addTest(TestCase test) {
-               
+
                tests.put(test.getTestID(), test);
-               
+
                currentTestSuite.addTestCase(test);
-               
-               
-               //if we run all tests. then this is the end of this test suite.
-               if( currentTestSuite != root && currentTestSuite.isFinished()) {
-                       
+
+               // if we run all tests. then this is the end of this test suite.
+               if (currentTestSuite != root && currentTestSuite.isFinished()) {
+
                        currentTestSuite = currentTestSuite.getParent();
 
-               }                               
-               
-       } 
+               }
+
+       }
 
        /**
         * @param suite
         * @param numTestsRunSinceStartOfTestSuite
         */
        public void addTestSuite(TestSuite suite) {
-       
-       
-       if(root == null) {
-               root = suite;
-       } 
-       else {
-       
-               //add as sibling        
+
+               if (root == null) {
+                       root = suite;
+               } else {
+
+                       // add as sibling
                        currentTestSuite.addTestSuite(suite);
                        suite.setParent(currentTestSuite);
 
-       }       
-       
-               currentTestSuite = suite;       
+               }
+
+               currentTestSuite = suite;
        }
 
        /**
         * @return
         */
        public TestSuite getRoot() {
-               
+
                return root;
        }
-       
+
        /**
         * @param r
         */
@@ -86,87 +82,81 @@ public class TestPool {
                this.root = r;
        }
 
-
-       
        /**
         * @param testID
         * @return
         */
        public TestCase getTest(String testID) {
-                               
+
                return (TestCase) tests.get(testID);
        }
 
        public String toString() {
-               
+
                String string = "";
-               
+
                TestSuite node = root;
-               
+
                string = root.toString();
 
-               return string;                  
-       
-       }
+               return string;
 
+       }
 
        public int getNumTestsOverall() {
-       
+
                int total = root.getNumTestCasesExpected();
                System.out.println("total: " + total);
                return total;
-                               
+
        }
-       
+
        public int getNumTestsRun() {
-               
+
                return tests.size();
-               
-                       
+
        }
-       
+
        public int getNumFailures() {
-               
+
                int total = 0;
-               
-//             Iterator i = tests.keySet().iterator();
-//             String key = "";
-//             while (i.hasNext()) {
-//                     
-//                     
-//                     key = (String) i.next();
-//                     TestCase element = (TestCase) tests.get(key);
-//                     
-//                     
-//                     if(element.isFailure())
-//                             total++;
-//                     
-//             }
-                       
+
+               // Iterator i = tests.keySet().iterator();
+               // String key = "";
+               // while (i.hasNext()) {
+               //                      
+               //                      
+               // key = (String) i.next();
+               // TestCase element = (TestCase) tests.get(key);
+               //                      
+               //                      
+               // if(element.isFailure())
+               // total++;
+               //                      
+               // }
+
                return total;
        }
-       
+
        public int getNumErrors() {
 
                int total = 0;
-               
-//             Iterator i = tests.keySet().iterator();
-//             String key = "";
-//             while (i.hasNext()) {
-//                     
-//                     
-//                     key = (String) i.next();
-//                     TestCase element = (TestCase) tests.get(key);
-//                                             
-//                     if(element.isError())
-//                             total++;
-//                     
-//             }
-                       
+
+               // Iterator i = tests.keySet().iterator();
+               // String key = "";
+               // while (i.hasNext()) {
+               //                      
+               //                      
+               // key = (String) i.next();
+               // TestCase element = (TestCase) tests.get(key);
+               //                                              
+               // if(element.isError())
+               // total++;
+               //                      
+               // }
+
                return total;
-       
+
        }
-       
-       
 
 }