Created
August 17, 2022 22:53
-
-
Save Bachmann1234/7f1b38f9c89c6d3852b2209978458f73 to your computer and use it in GitHub Desktop.
Triggers false warning in intellij
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
import org.junit.jupiter.api.Assertions | |
import org.junit.jupiter.api.BeforeEach | |
import org.junit.jupiter.api.Test; | |
import org.junit.jupiter.api.extension.ExtendWith | |
import org.junit.jupiter.api.extension.ExtensionContext | |
import org.junit.jupiter.api.extension.ParameterContext | |
import org.junit.jupiter.api.extension.ParameterResolver | |
class BasicParameterResolver : ParameterResolver { | |
override fun supportsParameter(parameterContext: ParameterContext?, extensionContext: ExtensionContext?): Boolean { | |
return parameterContext != null && parameterContext.parameter.type == ValueBox::class.java | |
} | |
override fun resolveParameter(parameterContext: ParameterContext?, extensionContext: ExtensionContext?): Any { | |
return ValueBox(2) | |
} | |
} | |
class ValueBox constructor(val value: Int) { | |
} | |
@ExtendWith(BasicParameterResolver::class) | |
open class AbstractTest { | |
} | |
class TestMain: AbstractTest() { | |
private lateinit var valueBox : ValueBox; | |
@BeforeEach | |
fun beforeEach(valueBox : ValueBox){ | |
this.valueBox = valueBox | |
} | |
@Test | |
fun testWasSetToTwo() { | |
Assertions.assertEquals(2, valueBox.value) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment