title: JUnit error - IllegalArgumentException:Test class can only have one constructor
body: <p>Unit testing is new to me, and I have this error I don't understand.
  I have 2 TestCases subclasses that work fine when ran standalone, but not in my test suite.</p>
  
  <p>In the test suite (AllTest class below), the first 3 work fine, but AvailableResouresTest and ModelTest generate the error.</p>
  
  <p>I suspect it has to do with the fact that I had to import those 2 classes (and only them) in AllTest whereas they are all located in the same package. </p>
  
  <p>I used the Eclipse wizard to create those two test cases. However, I can't find noticeable differences in the code, so may be some fresh eye can help. Thank you very much</p>
  
  <p>The test suite code:</p>
  
  <pre><code>package com.tms.client.tests;
  import org.junit.runner.RunWith;
  import org.junit.runners.Suite;
  import org.junit.runners.Suite.SuiteClasses;
  import com.tms.client.model.AvailableResources;  // I have to import those 2 classes only
  import com.tms.client.model.Model;               // but all my tests are in the same folder
  
  @RunWith(Suite.class)
  @SuiteClasses(value = { TaskTest.class, 
                      ResourceTest.class,
                      DateForTMSTest.class,
                      AvailableResources.class,
                      Model.class})
  public class AllTests{
  public static final String SCHEME_FILENAME= "config/project_schema.inc2.xsd";
  public static final String RESOURCE_FILENAME = "config/resourceList.inc2.txt";
  public static final String PROJECT_FILENAME = "input/project.inc2.e.xml";
  public static final String PROJECT_FILENAME_SAVE_LOCATION =     "input/project.save.tmp.xml";
  }
  </code></pre>
  
  <p>The non working test:</p>
  
  <pre><code>package com.tms.client.tests;
  import java.util.ArrayList;
  import java.util.Hashtable;
  import junit.framework.TestCase;
  import org.junit.Before;
  import org.junit.Test;
  import com.tms.client.model.AvailableResources;
  import com.tms.client.model.Model;
  import com.tms.client.model.ParseXML;
  import com.tms.client.model.Task;
  
  public class AvailableResourcesTest extends TestCase{
  
  ArrayList&lt;String&gt; stringsFromFile;
  Class&lt;AvailableResources&gt; dummyAR;
  Model model;
  
  @SuppressWarnings("unchecked")
  @Before
  public void setUp() throws Exception {
      super.setUp();
      ParseXML.setSchemaFile(AllTests.SCHEME_FILENAME);
      model = new Model(AllTests.RESOURCE_FILENAME, AllTests.PROJECT_FILENAME);
      dummyAR = AvailableResources.class;
      stringsFromFile = Helper.getLinesFromFile(AllTests.RESOURCE_FILENAME);
  }
  
  @SuppressWarnings("unchecked")
  @Test
  public void testFlushAllResources() {
      //Get the size BEFORE flushing
      Hashtable&lt;Integer,Task&gt; mapIdToObject = (Hashtable&lt;Integer,Task&gt;) PrivateAccessor.getPrivateFieldStatic(dummyAR, "mapIDtoName");
      int sizeBeforeFlush = mapIdToObject.size();
      // Flush tasks
      PrivateAccessor.invokePrivateMethodStatic(dummyAR, "flushAllResources", null);
      // Get the size AFTER flushing
      mapIdToObject = (Hashtable&lt;Integer,Task&gt;) PrivateAccessor.getPrivateFieldStatic(dummyAR, "mapIDtoName");
      int sizeAfterFlush = mapIdToObject.size();
      boolean test = sizeBeforeFlush &gt; 0 &amp;&amp; sizeAfterFlush == 0;  
      // Add code to remove task
      assertTrue(test);       
  }
  
  /**
   * Compare # lines in resource file with mapIdToName.size()
   */
  @Test
  public void testSize() {
      Hashtable&lt;Integer,Task&gt; mapIdToName = (Hashtable&lt;Integer,Task&gt;) PrivateAccessor.getPrivateFieldStatic(dummyAR, "mapIDtoName");
      assertEquals(mapIdToName.size(), stringsFromFile.size());
  }
  
  /**
   * Check that every resource id from file is available in model
   */
  @Test
  public void testIsAvailable() {
      for(String s: stringsFromFile){
          int resourceId = Integer.parseInt(s.split(";")[0]); // the resourceId from file
          assertTrue(AvailableResources.isAvailable(resourceId));
      }
  }
  
  /**
   * Check that the name returned corresponds to the name in file
   */
  @Test
  public void testGetNameFromID() {
      for(String s: stringsFromFile){
          int resourceId = Integer.parseInt(s.split(";")[0]); // the resourceId from file
          String resourceName = s.split(";")[1]; // the resourceId from file
          assertEquals(AvailableResources.getNameFromID(resourceId), resourceName);
      }
  }
  
  @Test
  public void testAddNameByID() {
      fail("Not yet implemented");
  
  }
  
  @Test
  public void testRemoveResourceByID() {
      fail("Not yet implemented");
  }
  }
  </code></pre>
  
  <p>And the stack trace:</p>
  
  <pre><code>java.lang.IllegalArgumentException: Test class can only have one constructor
  at org.junit.runners.model.TestClass.&lt;init&gt;(TestClass.java:37)
  at org.junit.runners.ParentRunner.&lt;init&gt;(ParentRunner.java:73)
  at org.junit.runners.BlockJUnit4ClassRunner.&lt;init&gt;(BlockJUnit4ClassRunner.java:55)
  at org.junit.internal.builders.JUnit4Builder.runnerForClass(JUnit4Builder.java:13)
  at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
  at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
  at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
  at org.junit.runners.model.RunnerBuilder.runners(RunnerBuilder.java:98)
  at org.junit.runners.model.RunnerBuilder.runners(RunnerBuilder.java:84)
  at org.junit.runners.Suite.&lt;init&gt;(Suite.java:101)
  at org.junit.runners.Suite.&lt;init&gt;(Suite.java:67)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
  at java.lang.reflect.Constructor.newInstance(Unknown Source)
  at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:35)
  at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
  at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
  at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
  at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
  at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
  at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.&lt;init&gt;(JUnit4TestReference.java:33)
  at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.&lt;init&gt;(JUnit4TestClassReference.java:25)
  at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48)
  at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38)
  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
  </code></pre>