Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.