Skip to content

Instantly share code, notes, and snippets.

@jeremyrempel
Created July 11, 2020 22:21
Show Gist options
  • Save jeremyrempel/97d0dd28ea6fb3778761fb553ef66eb1 to your computer and use it in GitHub Desktop.
Save jeremyrempel/97d0dd28ea6fb3778761fb553ef66eb1 to your computer and use it in GitHub Desktop.
class AndroidWtfLogUsageDetectorTest : LintDetectorTest() {
@Test
fun `test given kotlin log wtf usage one failure reported`() {
lint()
.sdkHome(File("/path/to/Android/Sdk"))
.files(
java(
"""
import android.util.Log;
public class TestClass1 {
public void doSomething() {
Log.wtf("wtf", "this is another err");
}
}
"""
).indented()
)
.run()
.expect(
"""
TestClass1.java:7: Warning: Use Log.f rather than Log.wtf [LogWtfUsage]
Log.wtf("wtf", "this is another err");
~~~~~~~
0 errors, 1 warnings
"""
)
}
override fun getDetector() = AndroidWtfLogUsageDetector()
override fun getIssues() = listOf(AndroidWtfLogUsageDetector.ISSUE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment