Skip to content

Commit

Permalink
Got test environment running with roboguice
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickbaumann committed Mar 19, 2011
1 parent 5e255a4 commit 36e06de
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
Expand Up @@ -7,7 +7,6 @@

import gov.nasa.arc.geocam.memo.service.DjangoMemoInterface;

@Singleton
public class FakeDjangoMemoImplementation implements DjangoMemoInterface{

@Override
Expand Down
Expand Up @@ -16,15 +16,17 @@ public InjectedTestRunner(Class<?> testClass) throws InitializationError {
super(testClass);
}

@Override protected Application createApplication() {
@Override
protected Application createApplication() {
GeoCamMemoRoboApplication application =
(GeoCamMemoRoboApplication)super.createApplication();

application.setModule(new TestInjectedModule());
return application;
}

@Override public void prepareTest(Object test){
@Override
public void prepareTest(Object test){
GeoCamMemoRoboApplication application =
(GeoCamMemoRoboApplication)Robolectric.application;

Expand Down
Expand Up @@ -10,7 +10,6 @@ public class TestInjectedModule extends AbstractAndroidModule {

@Override
protected void configure() {
bind(Counter.class).in(Scopes.SINGLETON);
bind(DjangoMemoInterface.class).to(FakeDjangoMemoImplementation.class);
}
}
2 changes: 1 addition & 1 deletion android/default.properties
Expand Up @@ -8,4 +8,4 @@
# project structure.

# Project target.
target=android-8
target=android-8
Expand Up @@ -8,10 +8,11 @@ public class GeoCamMemoRoboApplication extends RoboApplication{
private Module module = new GeoCamMemoModule();

protected void addApplicationModules(List<Module> modules) {
modules.add(new GeoCamMemoModule());
modules.add(this.module);
}

public void setModule(Module module) {
this.module = module;

}
}

0 comments on commit 36e06de

Please sign in to comment.