Skip to content

Instantly share code, notes, and snippets.

View ohade's full-sized avatar

Ohad Edelstein ohade

View GitHub Profile
client_code_version cnt_20 cnt_21 cnt_22 cnt_23 cnt_24 cnt_25 cnt_26 cnt_27 cnt_28 cnt_29 cnt_30 cnt_31
8.43.0 0 0 0 0 0 0 0 0 169084 313426 304943 296302
8.42.0 0 0 175167 337907 401083 362409 388085 412845 132041 2487 1498 881
8.41.0 327918 298443 132229 2873 1436 877 562 474 408 324 318 218
8.40.0 497 405 390 269 210 151 146 122 98 90 79 74
8.39.0 57 61 40 40 38 25 26 16 13 8 13 5
8.38.1 45 38 37 36 23 24 24 19 11 8 21 11
8.38.0 6 2 2 6 4 3 3 1 1 1 0 0
8.37.1 1 1 2 1 0 0 0 0 0 0 0 0
8.37.0 25 13 32 29 28 30 18 7 7 8 22 13
public class EntranceChecker {
private final Set<String> names;
public EntranceChecker(Set<String> names) {
this.names = names;
}
public boolean isInTheGuestList(Person person) {
if(person == null) {
return true;
}
public class EntranceChecker {
private final Set<String> names;
public EntranceChecker(Set<String> names) {
this.names = names;
}
boolean isInTheGuestList(Person person) {
if(person == null) {
return true;
}
@RunWith(MockitoJUnitRunner.class)
public class BouncerTest {
@Mock
private EntranceChecker entranceChecker;
private Bouncer bouncer;
@Mock
Person inListPerson;
@RunWith(MockitoJUnitRunner.class)
public class BouncerTest {
@Mock
private EntranceChecker mockEntranceChecker;
@Mock
private Person mockInListPerson;
@Mock
private Person mockNotInListPerson;
@ohade
ohade / Bouncer.java
Last active May 10, 2019 09:03
Bouncer class for medium article
public class Bouncer {
private final EntranceChecker entranceChecker;
public Bouncer(EntranceChecker entranceChecker) {
this.entranceChecker = entranceChecker;
}
public boolean shouldBlock(Person person) {
return !entranceChecker.isInTheGuestList(person);
}