Skip to content

Instantly share code, notes, and snippets.

@tpiekarski
Created March 6, 2020 21:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tpiekarski/dc1dea66a4c8aadcf778c61fcc54de85 to your computer and use it in GitHub Desktop.
Save tpiekarski/dc1dea66a4c8aadcf778c61fcc54de85 to your computer and use it in GitHub Desktop.
A mock for Log while running tests for Android
package android.util;
import java.util.Locale;
import static java.lang.System.out;
@SuppressWarnings("UnusedReturnValue")
public class Log {
private static final int DEFAULT_RETURN_VALUE = 0;
private static Locale DEFAULT_LOCALE = Locale.getDefault();
public static int d(String tag, String message) {
out.println(String.format(DEFAULT_LOCALE, "DEBUG: %s: %s", tag, message));
return DEFAULT_RETURN_VALUE;
}
public static int i(String tag, String message) {
out.println(String.format(DEFAULT_LOCALE, "INFO: %s: %s", tag, message));
return DEFAULT_RETURN_VALUE;
}
public static int w(String tag, String message) {
out.println(String.format(DEFAULT_LOCALE, "WARN: %s: %s", tag, message));
return DEFAULT_RETURN_VALUE;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment