Suppress YamlConfig deprecation
parent
d640f58316
commit
5a4c391b52
File diff suppressed because one or more lines are too long
|
@ -2,12 +2,16 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
@file:Suppress("Deprecation")
|
||||||
|
|
||||||
package org.mozilla.fenix.detektrules
|
package org.mozilla.fenix.detektrules
|
||||||
|
|
||||||
import io.gitlab.arturbosch.detekt.test.lint
|
import io.gitlab.arturbosch.detekt.api.Config
|
||||||
import io.gitlab.arturbosch.detekt.api.YamlConfig
|
import io.gitlab.arturbosch.detekt.api.YamlConfig
|
||||||
|
import io.gitlab.arturbosch.detekt.test.lint
|
||||||
import org.junit.jupiter.api.Assertions.assertEquals
|
import org.junit.jupiter.api.Assertions.assertEquals
|
||||||
import org.junit.jupiter.api.Assertions.assertTrue
|
import org.junit.jupiter.api.Assertions.assertTrue
|
||||||
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.DisplayName
|
import org.junit.jupiter.api.DisplayName
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.junit.jupiter.params.ParameterizedTest
|
import org.junit.jupiter.params.ParameterizedTest
|
||||||
|
@ -17,10 +21,18 @@ import org.junit.jupiter.params.provider.MethodSource
|
||||||
import java.util.stream.Stream
|
import java.util.stream.Stream
|
||||||
|
|
||||||
internal class MozillaBannedPropertyAccessTest {
|
internal class MozillaBannedPropertyAccessTest {
|
||||||
|
|
||||||
|
private lateinit var config: Config
|
||||||
|
|
||||||
|
@BeforeEach
|
||||||
|
fun setup() {
|
||||||
|
config = YamlConfig.loadResource(this.javaClass.getResource("/config.yml"))
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
internal fun `non compliant property access should warn`() {
|
internal fun `non compliant property access should warn`() {
|
||||||
val findings =
|
val findings =
|
||||||
MozillaBannedPropertyAccess(YamlConfig.loadResource(this.javaClass.getResource("/config.yml"))).lint(
|
MozillaBannedPropertyAccess(config).lint(
|
||||||
NONCOMPLIANT_ACCESS.trimIndent()
|
NONCOMPLIANT_ACCESS.trimIndent()
|
||||||
)
|
)
|
||||||
assertEquals(1, findings.size)
|
assertEquals(1, findings.size)
|
||||||
|
@ -32,7 +44,7 @@ internal class MozillaBannedPropertyAccessTest {
|
||||||
@ParameterizedTest(name = "{1} should not warn")
|
@ParameterizedTest(name = "{1} should not warn")
|
||||||
internal fun testCompliantWhen(source: String) {
|
internal fun testCompliantWhen(source: String) {
|
||||||
val findings =
|
val findings =
|
||||||
MozillaBannedPropertyAccess(YamlConfig.loadResource(this.javaClass.getResource("/config.yml"))).lint(
|
MozillaBannedPropertyAccess(config).lint(
|
||||||
source
|
source
|
||||||
)
|
)
|
||||||
assertTrue(findings.isEmpty())
|
assertTrue(findings.isEmpty())
|
||||||
|
|
Loading…
Reference in New Issue