Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: priyaaank/RobolectricSample
base: master
...
head fork: gmkayaker/RobolectricSample
compare: master
Checking mergeability… Don’t worry, you can still create the pull request.
  • 12 commits
  • 16 files changed
  • 0 commit comments
  • 5 contributors
Commits on Jan 27, 2011
@rharing rharing Changed com.google.inject.guice dependency without classifier
Using maven 2.2.1 I was not able to run your tests since the dependency on guice-2.0-no_aop could not be resolved
e524b39
Commits on Feb 08, 2011
@mosabua mosabua changed to use guice no aop artifact deployed in maven central 27ed052
@mosabua mosabua refactored to use roboguice 1.1. as deployed in maven central (test f…
…ailure fix still outstanding)
39a8c62
Commits on Feb 09, 2011
@mosabua mosabua added workaround for problem of Roboguice Ln BaseConfig init, more de… cf07de7
Commits on Feb 13, 2011
Phil Goodwin & Tyler Schultz Merge branch 'master' of https://github.com/mosabua/RobolectricSample
…into mosabua-master
c255b81
Phil Goodwin & Tyler Schultz Update the roboguice jars to 1.1 2a25ddf
Commits on Jun 07, 2011
@tylerschultz tylerschultz Update Http to use the intended buffer size
Update Roboguice'd classes to use new class names.
521f696
Commits on Jun 09, 2011
@tylerschultz tylerschultz Revert "Update Http to use the intended buffer size"
This reverts commit 521f696.
e0d9501
@tylerschultz tylerschultz update Http's buffer size to intended value 9c19f1e
@Nuriaion Nuriaion without mvn package the apk is not build a96cb28
Commits on Jun 11, 2011
Tyler Schultz Custom View testing example 2fa6e2c
Commits on Jun 19, 2011
@tylerschultz tylerschultz Merge pull request #4 from Nuriaion/patch-1
without mvn package the apk is not build
1495359
View
2  AndroidManifest.xml
@@ -7,7 +7,7 @@
android:label="@string/app_name"
android:theme="@android:style/Theme.Light.NoTitleBar"
android:icon="@drawable/app_icon"
- android:name=".injected.SampleGuiceApplication"
+ android:name=".injected.SampleRoboApplication"
>
<activity android:name=".HomeActivity">
<intent-filter>
View
2  README
@@ -29,7 +29,7 @@ To build and run tests:
mvn clean test
To install the sample app on the emulator:
- mvn android:deploy
+ mvn package android:deploy
BUILDING WITH ANT
View
BIN  lib/main/roboguice-1.0.jar
Binary file not shown
View
BIN  lib/main/roboguice-1.1.jar
Binary file not shown
View
BIN  lib/test/roboguice-1.0-sources.jar
Binary file not shown
View
BIN  lib/test/roboguice-1.1-sources.jar
Binary file not shown
View
15 pom.xml
@@ -7,14 +7,6 @@
<packaging>apk</packaging>
<name>RobolectricSample app</name>
- <repositories>
- <repository>
- <id>maven2-repository.dev.java.net</id>
- <name>Java.net Repository for Maven</name>
- <url>http://download.java.net/maven/2/</url>
- </repository>
- </repositories>
-
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
@@ -24,16 +16,15 @@
</dependency>
<dependency>
- <groupId>roboguice</groupId>
+ <groupId>org.roboguice</groupId>
<artifactId>roboguice</artifactId>
- <version>1.0</version>
+ <version>1.1</version>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
- <version>2.0</version>
- <classifier>no-aop</classifier>
+ <version>2.0-no_aop</version>
</dependency>
<dependency>
View
22 res/layout/loading_text.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<com.pivotallabs.views.LoadingTextView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ >
+
+ <include
+ android:id="@+id/loading_text_spinner"
+ layout="@layout/loading_view"
+ android:visibility="visible"
+ />
+
+ <TextView
+ android:id="@+id/loading_text_text_view"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:visibility="invisible"
+ />
+
+</com.pivotallabs.views.LoadingTextView>
View
1  res/values/strings.xml
@@ -12,4 +12,5 @@
<string name="recent_activity">Recent Activity</string>
<string name="injected_activity">Roboguice Injected Activity</string>
<string name="injected_activity_caption">Roboguice Activity tested with Robolectric</string>
+ <string name="unit_tests_ftw">Unit Tests FTW!!!</string>
</resources>
View
2  src/main/java/com/pivotallabs/api/Http.java
@@ -81,7 +81,7 @@ private DefaultHttpClient getPromiscuousDefaultClient() {
}
public static class Response {
- private static final int BUFFER_SIZE = 2 ^ 12;
+ private static final int BUFFER_SIZE = 4096;
private int statusCode;
private String responseBody;
View
4 src/main/java/com/pivotallabs/injected/InjectedActivity.java
@@ -4,7 +4,7 @@
import android.widget.TextView;
import com.google.inject.Inject;
import com.pivotallabs.R;
-import roboguice.activity.GuiceActivity;
+import roboguice.activity.RoboActivity;
import roboguice.inject.InjectResource;
import roboguice.inject.InjectView;
@@ -12,7 +12,7 @@
import java.util.Date;
import java.util.Locale;
-public class InjectedActivity extends GuiceActivity {
+public class InjectedActivity extends RoboActivity {
@InjectResource(R.string.injected_activity_caption) String caption;
@InjectView(R.id.injected_text_view) TextView injectedTextView;
View
4 ...labs/injected/SampleGuiceApplication.java → ...llabs/injected/SampleRoboApplication.java
@@ -1,11 +1,11 @@
package com.pivotallabs.injected;
import com.google.inject.Module;
-import roboguice.application.GuiceApplication;
+import roboguice.application.RoboApplication;
import java.util.List;
-public class SampleGuiceApplication extends GuiceApplication {
+public class SampleRoboApplication extends RoboApplication {
private Module module = new RobolectricSampleModule();
@Override protected void addApplicationModules(List<Module> modules) {
View
30 src/main/java/com/pivotallabs/views/LoadingTextView.java
@@ -0,0 +1,30 @@
+package com.pivotallabs.views;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.View;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+import com.pivotallabs.R;
+
+public class LoadingTextView extends RelativeLayout {
+ public LoadingTextView(Context context) {
+ super(context);
+ }
+
+ public LoadingTextView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public LoadingTextView(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ }
+
+ public void stopLoadingAndSetText(int text_res_id) {
+ TextView textView = (TextView) findViewById(R.id.loading_text_text_view);
+ textView.setText(text_res_id);
+ textView.setVisibility(View.VISIBLE);
+
+ findViewById(R.id.loading_text_spinner).setVisibility(View.GONE);
+ }
+}
View
4 src/test/java/com/pivotallabs/injected/InjectedTestRunner.java
@@ -14,13 +14,13 @@ public InjectedTestRunner(Class<?> testClass) throws InitializationError {
}
@Override protected Application createApplication() {
- SampleGuiceApplication application = (SampleGuiceApplication)super.createApplication();
+ SampleRoboApplication application = (SampleRoboApplication)super.createApplication();
application.setModule(new RobolectricSampleTestModule());
return application;
}
@Override public void prepareTest(Object test) {
- SampleGuiceApplication application = (SampleGuiceApplication) Robolectric.application;
+ SampleRoboApplication application = (SampleRoboApplication) Robolectric.application;
//This project's application does not extend GuiceInjectableApplication therefore we need to enter the ContextScope manually.
Injector injector = application.getInjector();
View
15 src/test/java/com/pivotallabs/injected/RobolectricSampleTestModule.java
@@ -1,7 +1,9 @@
package com.pivotallabs.injected;
import com.google.inject.Scopes;
+import android.util.Log;
import roboguice.config.AbstractAndroidModule;
+import roboguice.util.Ln;
import java.util.Date;
@@ -10,5 +12,16 @@
@Override protected void configure() {
bind(Counter.class).in(Scopes.SINGLETON);
bind(Date.class).toProvider(FakeDateProvider.class);
+ bind(Ln.BaseConfig.class).toInstance(new RobolectricLoggerConfig());
}
-}
+
+
+ static class RobolectricLoggerConfig extends Ln.BaseConfig {
+ public RobolectricLoggerConfig() {
+ super();
+ this.packageName = "robo";
+ this.minimumLogLevel = Log.VERBOSE;
+ this.scope = "ROBO";
+ }
+ }
+}
View
46 src/test/java/com/pivotallabs/views/LoadingTextViewTest.java
@@ -0,0 +1,46 @@
+package com.pivotallabs.views;
+
+import android.app.Activity;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.TextView;
+import com.pivotallabs.R;
+import com.xtremelabs.robolectric.RobolectricTestRunner;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.hamcrest.core.IsEqual.equalTo;
+import static org.junit.Assert.assertThat;
+
+@RunWith(RobolectricTestRunner.class)
+public class LoadingTextViewTest {
+ private LoadingTextView loadingTextView;
+ private View loadingSpinner;
+ private TextView loadingTextTextView;
+
+ @Before
+ public void setUp() throws Exception {
+ loadingTextView = (LoadingTextView) LayoutInflater.from(new Activity()).inflate(R.layout.loading_text, null);
+ loadingSpinner = loadingTextView.findViewById(R.id.loading_text_spinner);
+ loadingTextTextView = (TextView) loadingTextView.findViewById(R.id.loading_text_text_view);
+ }
+
+ @Test
+ public void testStopLoadingAndSetTextShouldHideTheSpinnerAndShowTheTextView() throws Exception {
+ assertThat(loadingSpinner.getVisibility(), equalTo(View.VISIBLE));
+ assertThat(loadingTextTextView.getVisibility(), equalTo(View.INVISIBLE));
+
+ loadingTextView.stopLoadingAndSetText(R.string.unit_tests_ftw);
+
+ assertThat(loadingSpinner.getVisibility(), equalTo(View.GONE));
+ assertThat(loadingTextTextView.getVisibility(), equalTo(View.VISIBLE));
+ }
+
+ @Test
+ public void testStopLoadingAndSEtTextShouldSetTheTextOnTheTextView() {
+ loadingTextView.stopLoadingAndSetText(R.string.unit_tests_ftw);
+
+ assertThat((String) loadingTextTextView.getText(), equalTo("Unit Tests FTW!!!"));
+ }
+}

No commit comments for this range

Something went wrong with that request. Please try again.