Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2014
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. package com.whatever;
  2.  
  3. public class Parent
  4. {
  5. public void PlayWithChild(Child child)
  6. {
  7. child.Hug();
  8. }
  9. }
  10.  
  11. package com.whatever.subpackage;
  12.  
  13. public class Child
  14. {
  15. public void Hug()
  16. {
  17. }
  18. }
  19.  
  20. package com.whatever;
  21.  
  22. import com.whatever.subpackage;
  23.  
  24. public class Test
  25. {
  26. @Test
  27. public void PlayWithChild_ChildHugged()
  28. {
  29. //Arrange
  30. Child mckChild = Mockito.mock(Child.class);
  31.  
  32. //Act
  33. new Parent(mckChild).PlayWithChild();
  34.  
  35. //Assert
  36. Mockito.verify(mckChild).Hug();
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement