Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import com.fnproject.fn.testing.*
- import org.junit.*
- import org.junit.Assert.*
- import kotlin.test.assertEquals
- class HelloFunctionTest {
- @Rule @JvmField
- val fn = FnTestingRule.createDefault()
- @Test
- fun shouldReturnDefaultGreeting() {
- fn.givenEvent().enqueue()
- fn.thenRun("HelloFunction","hello")
- assertEquals("Hello, world!", fn.getOnlyResult().getBodyAsString())
- }
- @Test
- fun shouldReturnGreeting() {
- fn.givenEvent().withBody("Jhonny").enqueue()
- fn.thenRun("HelloFunction","hello")
- assertEquals("Hello, Jhonny", fn.getOnlyResult().getBodyAsString())
- }
- }
Add Comment
Please, Sign In to add comment