Created
March 6, 2020 21:07
-
-
Save tpiekarski/dc1dea66a4c8aadcf778c61fcc54de85 to your computer and use it in GitHub Desktop.
A mock for Log while running tests for Android
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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