Skip to content

Instantly share code, notes, and snippets.

View Nilhcem's full-sized avatar

Gautier MECHLING Nilhcem

View GitHub Profile
Nilhcem / gist:6f00b08f7c5cda269759
Created March 9, 2015 12:39
Automatically sync your data into truecrypt containers
# Synchronize files into truecrypt containers using tcplay

#[Tutorial] Android unit testing with Gradle, Robolectric, Dagger and Mockito Not long ago I faced the problem of setting up Gradle, Robolectric and Dagger for unit testing my app. And after tinkering a bit, I managed to make them all work together. In this tutorial I assume that you know how to work with Gradle, Robolectric, Dagger and Mockito separately.

I'm just going to show that they can work together pretty neatly, and how can they make Android testing a lot easier ##Wiring Robolectric and Gradle First of all, you're going to need a fully set up Android project ready to be built with Gradle. And I'm assuming that you're using default project layout (e.g. your java sources are located in $projectDir/src/main/java/)

For the next step we need to install a [Gradle Android test plugin][1] to a local maven repository:

Set up Robolectric with Gradle

  1. Open your top level build.gradle file.

  2. Add Sonatype repo to buildscript repositories and Square Gradle Android Test Plugin to buildscript dependencies. (Older Gradle projects may automatically put this buildscript code in your project build.gradle, in which situation you should put the following in that file.)

Nilhcem / com.partycv error
Created February 25, 2013 14:26
Got this after I tried 3 times my linkedin password (could not remember it the first 2 times.) at last it worked, but app crashed just after. Otherwise great idea - I was actually planning to create an Android app resume similar to the one you made previously - I think it will be very instructing. Will you release the sources?
E/AndroidRuntime( 9811): FATAL EXCEPTION: main
E/AndroidRuntime( 9811): java.lang.RuntimeException: Could not dispatch event: class com.partycv.event.ProfileLoadedEvent to handler [EventHandler public void com.partycv.DisplayCvActivity.onProfileUpdated(com.partycv.event.ProfileLoadedEvent)]
E/AndroidRuntime( 9811): at com.squareup.otto.Bus.dispatch(
E/AndroidRuntime( 9811): at com.squareup.otto.Bus.dispatchQueuedEvents(
E/AndroidRuntime( 9811): at
E/AndroidRuntime( 9811): at com.partycv.LinkedInClient$5.onSuccess(
E/AndroidRuntime( 9811): at com.partycv.LinkedInClient$5.onSuccess(
E/AndroidRuntime( 9811): at com.partycv.AsyncHandler$
E/AndroidRuntime( 9811): at android.os.Handler.handleCallback(
E/AndroidRuntime( 9811): at android.os.Handler.dispatchMessage(