Guest User

Untitled

a guest
Jul 23rd, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. package com.fn.example
  2. import com.fnproject.fn.testing.*
  3. import org.junit.*
  4. import kotlin.test.assertEquals
  5.  
  6. class HelloFunctionTest {
  7.  
  8. @Rule @JvmField
  9. val fn = FnTestingRule.createDefault()
  10.  
  11. @Test
  12. fun `should return default greeting`() {
  13. with (fn) {
  14. givenEvent().enqueue()
  15. thenRun("com.fn.example.HelloFunctionKt","hello")
  16. assertEquals("Hello, world!", getOnlyResult().getBodyAsString())
  17. }
  18. }
  19.  
  20. @Test
  21. fun `should return personalized greeting`() {
  22. with (fn) {
  23. givenEvent().withBody("Jhonny").enqueue()
  24. thenRun("com.fn.example.HelloFunctionKt","hello")
  25. assertEquals("Hello, Jhonny", getOnlyResult().getBodyAsString())
  26. }
  27. }
  28.  
  29. }
Add Comment
Please, Sign In to add comment