Last active
May 10, 2019 09:53
-
-
Save ohade/45be02ebba12787c93c6525c2596d609 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RunWith(MockitoJUnitRunner.class) | |
public class BouncerTest { | |
@Mock | |
private EntranceChecker mockEntranceChecker; | |
@Mock | |
private Person mockInListPerson; | |
@Mock | |
private Person mockNotInListPerson; | |
private Bouncer bouncer; | |
@Before | |
public init() { | |
Mockito.when(mockEntranceChecker.isInTheGuestList(mockInListPerson)).thenReturn(true); | |
Mockito.when(mockEntranceChecker.isInTheGuestList(mockNotInListPerson)).thenReturn(false); | |
this.bouncer = new Bouncer(mockEntranceChecker); | |
} | |
@Test | |
public boolean shouldBlock_nullPerson_notBlock() { | |
boolean result = bouncer.shouldBlock(mockInListPerson); | |
Assert.assertTrue(result); | |
} | |
@Test | |
public boolean shouldBlock_nullPerson_block() { | |
boolean result = bouncer.shouldBlock(mockNotInListPerson); | |
Assert.assertTrue(result); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment