Hi,
I've created a SortedList Class, which has a Constructor that takes a java.util.Comparator as an argument.
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.
Here its my simple test (snippets)
public class SortedListTest {
class strcmp implements Comparator<String>{
public strcmp(){}
public int compare(String s1,String s2){
return s1.compareTo(s2);
}
}
@Test
public void testAdd(){
SortedList<String> list = new SortedList<String>(new strcmp());
}
}
Or an alternative way:
public void testAdd(){
SortedList<String> list = new SortedList<String>(new Comparator<String>(){
public int compare(String s1,String s2){
return s1.compareTo(s2);
}
});
}
The error Hudson shows is
ar.com.lib.SortedListTest$strcmp.initializationError0
Error Message
Test class should have public zero-argument constructor
Stacktrace
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)
I-ve tried using the @Ignore annotation, but no luck so far. It wont compile when i try
@Ignore class strcmp{}
Any ideas will be appreciated. Thanks in advance.