Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xian/709314 to your computer and use it in GitHub Desktop.
Save xian/709314 to your computer and use it in GitHub Desktop.
package com.pivotallabs;
import android.util.Log;
import com.xtremelabs.robolectric.Robolectric;
import com.xtremelabs.robolectric.RobolectricTestRunner;
import com.xtremelabs.robolectric.util.Implements;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(RobolectricTestRunner.class)
public class LogTest {
@Test
public void testLogging() throws Exception {
Robolectric.bindShadowClass(ShadowLog.class);
Log.i("LogTest", "log message");
}
@Implements(Log.class)
public static class ShadowLog {
public static int i(java.lang.String tag, java.lang.String msg) {
System.out.println("[" + tag + "] " + msg);
return 0;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment