Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. package com.project.myapplication
  2.  
  3. import org.junit.jupiter.api.Assertions.assertEquals
  4. import org.spekframework.spek2.Spek
  5. import org.spekframework.spek2.style.gherkin.Feature
  6.  
  7. object MathTest : Spek({
  8. Feature("math") {
  9. val math = Math()
  10.  
  11. Scenario("do multiplication") {
  12. var a = 0
  13. var b = 0
  14. var multiple = 0
  15. val result = 21
  16.  
  17. Given("initial a and b") {
  18. a = 3
  19. b = 7
  20. }
  21.  
  22. When("multiple a with b") {
  23. multiple = math.multiplication(a, b)
  24. }
  25.  
  26. Then("it should return multiplication between a and b") {
  27. assertEquals(result, multiple)
  28. }
  29. }
  30.  
  31. Scenario("do division") {
  32. var a = 0
  33. var b = 0
  34. var division = 0
  35. val result = 3
  36.  
  37. Given("initial a and b") {
  38. a = 21
  39. b = 7
  40. }
  41.  
  42. When("division a with b") {
  43. division = math.division(a, b)
  44. }
  45.  
  46. Then("it should return division between a and b") {
  47. assertEquals(result, division)
  48. }
  49. }
  50. }
  51. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement