Many thanks in advance for any help you can offer!
--
paul.butcher->msgCount++
Snetterton, Castle Combe, Cadwell Park...
Who says I have a one track mind?
http://www.paulbutcher.com/
LinkedIn: http://www.linkedin.com/in/paulbutcher
MSN: pa...@paulbutcher.com
AIM: paulrabutcher
Skype: paulrabutcher
@Injectpublic DbHelper(Provider<Application> contextProvider) {super(contextProvider.get(), DB_NAME, null, DB_VERSION);}
--
You received this message because you are subscribed to the Google Groups "roboguice" group.
To post to this group, send email to robo...@googlegroups.com.
To unsubscribe from this group, send email to roboguice+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/roboguice?hl=en.
I just checked in a preliminary version of RoboBroadcastReceiver on the default branch. Give that a try and let me know if that works for you. I did a quick test and it seems to work for me, but it hasn't been rigorously tested yet.
Cheers,
Mike
PS. Will look at your patches soon, thanks for the contribution!
Thanks!
Sent from my iPhone, so apologies if I'm a little terse.
java.lang.NoSuchMethodException: GrouponTestApplication(Context)at java.lang.Class.getMatchingConstructor(Class.java:660)at java.lang.Class.getConstructor(Class.java:477)at roboguice.test.RoboUnitTestCase.setUp(RoboUnitTestCase.java:50)at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:520)at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1447)
java.lang.RuntimeException: Exception during suite constructionat android.test.suitebuilder.TestSuiteBuilder$FailedToCreateTests.testSuiteConstructionFailed(TestSuiteBuilder.java:239)at java.lang.reflect.Method.invokeNative(Native Method)at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:520)at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1447)Caused by: java.lang.reflect.InvocationTargetExceptionat com.groupon.test.tests.AuthenticationTests.<init>(AuthenticationTests.java:29)at java.lang.reflect.Constructor.constructNative(Native Method)at java.lang.reflect.Constructor.newInstance(Constructor.java:446)at android.test.suitebuilder.TestMethod.instantiateTest(TestMethod.java:87)at android.test.suitebuilder.TestMethod.createTest(TestMethod.java:73)at android.test.suitebuilder.TestSuiteBuilder.addTest(TestSuiteBuilder.java:263)at android.test.suitebuilder.TestSuiteBuilder.build(TestSuiteBuilder.java:185)at android.test.InstrumentationTestRunner.onCreate(InstrumentationTestRunner.java:373)at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4218)at android.app.ActivityThread.access$3000(ActivityThread.java:125)at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2071)at android.os.Handler.dispatchMessage(Handler.java:99)at android.os.Looper.loop(Looper.java:123)at android.app.ActivityThread.main(ActivityThread.java:4627)at java.lang.reflect.Method.invokeNative(Native Method)at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)at dalvik.system.NativeStart.main(Native Method)Caused by: java.lang.NoClassDefFoundError: com.groupon.activity.TodaysDeal... 19 more
manfred
--
http://about.me/michaelburton
Ah! I forgot that our situation is unusual - we're testing a library project, not a separate application. Our setup is described in the following blog post:
http://www.paulbutcher.com/2010/09/android-library-project-with-tests-step-by-step/
> I'm surprised this change is working for you, actually. What motivated the change? Do you have any sample test classes that use your changes that I could take a look at?
You and I discussed the motivation a few months ago, in the following conversation :-)
Basically several of our tests set up a fixtures that require an injector to do so. Here's one example:
We have a class called "Predictor" (which, surprise!, makes predictions). It supports a listener (I won't go into the detail of what this listener does, as it's not relevant to this discussion). To avoid having to register a listener at the start of each test, we have the following in PredictorImplTest:
> public class PredictorImplTest extends RoboUnitTestCase<HarnessApplication> {
>
> class PredictorListenerImpl implements PredictorListener {
> // ...
> }
>
> PredictorListenerImpl listener = new PredictorListenerImpl();
> PredictorImpl predictor;
>
> @Override
> public void setUp() throws Exception {
> super.setUp();
>
> predictor = getInjector().getInstance(PredictorImpl.class);
> predictor.addListener(listener);
> }
>
> @Override
> public void tearDown() throws Exception {
> predictor.removeListener(listener);
> }
>
> // Tests that use predictor and listener go here
> }
Clearly we could move the setUp and tearDown code out into the individual test functions, but would prefer to avoid doing so if possible. Perhaps it won't be possible though :-(