java - Android test class fails to compile in eclipse with "bound mismatch" error -
i'm writing testcases android app extending activityinstrumentationtestcase2
. test class looks this:
public class solutionentryactivitytest extends activityinstrumentationtestcase2<solutionentryactivity> { public solutionentryactivitytest() { super(solutionentryactivity.class); } }
in eclipse, code fails compile error: bound mismatch: type solutionentryactivity not valid substitute bounded parameter <t extends activity> of type activityinstrumentationtestcase2<t>
but solutionentryactivity android.app.activity
, type hierarchy this:
activity ormlitebaseactivity<h> (abstract) kabowieactivity practiceactivity (abstract) solutionentryactivity
i found 2 eclipse bugs 2004 , 2005 seem deal similar problem these should long fixed.
i'm using eclipse helios android 2.2 , sun java 1.6.
any idea what's going on?
the problem when create test project android eclipse project, references project-to-be-tested external libraries not resolved automatically. class ormlitebaseactivity (see type hierarchy in originial question) comes external jar included in build path of project under test. external jar needs explicitely included in build path of test project well. not sure if considered bug , if so, where. expect libraries used original project should available test project. anyway, read question.
edit correction: adding same library buildpath twice (once 1 of project under test, , once testproject) not work because junit not understand both same library. compilation succeed logcat give error message saying superclasses of solutionentryactivity different sources. solution here export external libs original project (configure buildpath -> order , export -> select libs exported) instead of adding them buildpath of test project directly.
Comments
Post a Comment