Created
June 11, 2020 12:50
-
-
Save guilhermekrz/f26868adac9eb7c0248cd3c58a387b74 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class MoreThanOneOkHttpClientDetectorTest : AndroidSdkLintDetectorTest() { | |
override fun getDetector(): Detector = MoreThanOneOkHttpClientDetector() | |
override fun getIssues(): MutableList<Issue> = mutableListOf(MoreThanOneOkHttpClientDetector.ISSUE) | |
private val okHttpClientFile = java( | |
""" | |
package okhttp3; | |
class OkHttpClient { | |
public OkHttpClient() { | |
} | |
} | |
""" | |
).indented() | |
@Test | |
fun `one call to OkHttpClient constructor`() { | |
val javaFile = java( | |
""" | |
package com.brokoli.lint; | |
import okhttp3.OkHttpClient; | |
class MyClass { | |
public void method1() { | |
new OkHttpClient(); | |
} | |
} | |
""" | |
).indented() | |
val lintResult = lint() | |
.files(okHttpClientFile, javaFile) | |
.run() | |
lintResult.expectClean() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment