title: Junit inline comparator initialization error
body: <p>I've created a SortedList Class, which has a Constructor that takes a java.util.Comparator as an argument.</p>
  
  <p>After running Unit tests on my machine (through eclipse 3.3.0), everything was OK. However, Hudson complaints because it says it can't instantiate my comparator.</p>
  
  <p>Here its my simple test (snippets)</p>
  
  <pre><code>public class SortedListTest {
  
      class strcmp implements Comparator&lt;String&gt;{
          public strcmp(){}
  
          public int compare(String s1,String s2){
              return s1.compareTo(s2);
          }
      }
      @Test
      public void testAdd(){
          SortedList&lt;String&gt; list = new SortedList&lt;String&gt;(new strcmp());
          }
  }
  </code></pre>
  
  <p>Or an alternative way:</p>
  
  <pre><code>public void testAdd(){
          SortedList&lt;String&gt; list = new SortedList&lt;String&gt;(new Comparator&lt;String&gt;(){
              public int compare(String s1,String s2){
                  return s1.compareTo(s2);
              }
          });
  }
  </code></pre>
  
  <p>The error Hudson shows is </p>
  
  <blockquote>
    <p>ar.com.lib.SortedListTest$strcmp.initializationError0</p>
  </blockquote>
  
  <p>Error Message</p>
  
  <p>Test class should have public zero-argument constructor</p>
  
  <blockquote>
    <p>Stacktrace</p>
    
    <p>java.lang.Exception: Test class should
    have public zero-argument constructor
      at
    java.lang.reflect.Constructor.newInstance(Constructor.java:513)
      at
    java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    Caused by:
    java.lang.NoSuchMethodException:
    ar.com.lib.SortedListTest$strcmp.()
      at
    java.lang.Class.getConstructor0(Class.java:2706)
      at
    java.lang.Class.getConstructor(Class.java:1657)</p>
  </blockquote>
  
  <p>I-ve tried using the @Ignore annotation, but no luck so far. It wont compile when i try</p>
  
  <pre><code>@Ignore class strcmp{}
  </code></pre>
  
  <p>Any ideas will be appreciated. Thanks in advance.</p>