Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.whatever;
- public class Parent
- {
- public void PlayWithChild(Child child)
- {
- child.Hug();
- }
- }
- package com.whatever.subpackage;
- public class Child
- {
- public void Hug()
- {
- }
- }
- package com.whatever;
- import com.whatever.subpackage;
- public class Test
- {
- @Test
- public void PlayWithChild_ChildHugged()
- {
- //Arrange
- Child mckChild = Mockito.mock(Child.class);
- //Act
- new Parent(mckChild).PlayWithChild();
- //Assert
- Mockito.verify(mckChild).Hug();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement