roboguice.test
Class RoboUnitTestCase<AppType extends RoboApplication>

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by android.test.InstrumentationTestCase
              extended by roboguice.test.RoboUnitTestCase<AppType>
Type Parameters:
AppType - The type of your Application class. This class must have a constructor that accepts a Context argument and calls ContextWrapper.attachBaseContext(android.content.Context)
All Implemented Interfaces:
junit.framework.Test

public class RoboUnitTestCase<AppType extends RoboApplication>
extends android.test.InstrumentationTestCase

Use RoboUnitTestCase when you'd like to make simple unit tests that may depend on Context resources, but do not depend on Activities, Services, ContentProviders, or other Contexts directly. An example: public class MyTest extends RoboUnitTestCase { // Make sure you use one of the @*Test annotations AND begin // your testcase's name with "test" \@MediumTest public void test01() { // Make sure you're using com.mydomain.R, not com.mydomain.test.R assertEquals("Hello World, Lop!", getContext().getString(com.mydomain.R.string.hello)); } } Also, see the notes about your Application class below.


Field Summary
protected  com.google.inject.Injector injector
           
 
Constructor Summary
RoboUnitTestCase()
           
 
Method Summary
protected  Class<? extends RoboApplication> applicationType()
           
protected  com.google.inject.Injector getInjector()
           
protected  void runTest()
           
 
Methods inherited from class android.test.InstrumentationTestCase
getInstrumentation, injectInsrumentation, injectInstrumentation, launchActivity, launchActivityWithIntent, runTestOnUiThread, sendKeys, sendKeys, sendRepeatedKeys, tearDown
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, setName, setUp, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

injector

protected com.google.inject.Injector injector
Constructor Detail

RoboUnitTestCase

public RoboUnitTestCase()
Method Detail

runTest

protected void runTest()
                throws Throwable
Overrides:
runTest in class android.test.InstrumentationTestCase
Throws:
Throwable

getInjector

protected com.google.inject.Injector getInjector()

applicationType

protected Class<? extends RoboApplication> applicationType()


Copyright © 2011. All Rights Reserved.