Last active
May 10, 2019 09:15
-
-
Save ohade/e3a248d281cebc66e3c6b9ab9c584256 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 entranceChecker; | |
private Bouncer bouncer; | |
@Mock | |
Person inListPerson; | |
@Mock | |
Person notInListPerson; | |
@Before | |
public init() { | |
Mockito.when(entranceChecker.isInTheGuestList(inListPerson)).thenReturn(true); | |
Mockito.when(entranceChecker.isInTheGuestList(notInListPerson)).thenReturn(false); | |
this.bouncer = new Bouncer(entranceChecker); | |
} | |
@Test | |
public boolean shouldBlock_nullPerson_notBlock() { | |
boolean result = bouncer.shouldBlock(inListPerson); | |
Assert.assertTrue(result); | |
} | |
@Test | |
public boolean shouldBlock_nullPerson_block() { | |
boolean result = bouncer.shouldBlock(notInListPerson); | |
Assert.assertTrue(result); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment