Created
August 3, 2018 12:08
-
-
Save delabassee/fc41bfc2bebf126981702a75e6aae20e to your computer and use it in GitHub Desktop.
Default generated Kotlin JUnit rules
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 com.fnproject.fn.testing.* | |
import org.junit.* | |
import kotlin.test.assertEquals | |
class HelloFunctionTest { | |
@Rule @JvmField | |
val fn = FnTestingRule.createDefault() | |
@Test | |
fun `should return default greeting`() { | |
with (fn) { | |
givenEvent().enqueue() | |
thenRun("com.fn.example.HelloFunctionKt","hello") | |
assertEquals("Hello, world!", getOnlyResult().getBodyAsString()) | |
} | |
} | |
@Test | |
fun `should return personalized greeting`() { | |
with (fn) { | |
givenEvent().withBody("Jhonny").enqueue() | |
thenRun("com.fn.example.HelloFunctionKt","hello") | |
assertEquals("Hello, Jhonny", getOnlyResult().getBodyAsString()) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment