I am trying to extend ActivityInstrumentationTestCase2 as follows:
public abstract class FooActivityTestCase<T extends Activity> extends ActivityInstrumentationTestCase2<Activity> { public FooActivityTestCase(String pckg, Class<Activity> activityClass) { super(pckg, activityClass); } public void foo(){ ... } }
I am trying to extend FooActivityTestCase as follows:
public class SpecificFooTestCase extends FooActivityTestCase<MyActivity> { public SpecificFooTestCase() { super("foo.bar", MyActivity.class);
Eclipse gives me the following error in the constructor:
The constructor FooActivityTestCase<MyActivity>(String, Class<MyActivity>) is undefined
I am sure the problem is with how I use generics. When SpecificFooTestCase extends ActivityInstrumentationTestCase2 , I get no errors. Can someone point out what I'm doing wrong?
Offers Kublai Khan and Michael Myers work together. After I changed FooActivityTestCase to extend ActivityInstrumentationTestCase2<T> and Class<Activity> to Class<T> in the constructor, the classes compile without errors. This is the resulting class (SpecificFooTestCase has not changed):
public abstract class FooActivityTestCase<T extends Activity> extends ActivityInstrumentationTestCase2<T> { public FooActivityTestCase(String pckg, Class<T> activityClass) { super(pckg, activityClass); } public void foo(){ ... } }
source share