### Question:
Marble implements Entity { public boolean isCompatible(Marble other) { return other != null && (type.equals(MarbleType.JOKER) || other.type.equals(MarbleType.JOKER) || type.equals(other.type)); } Marble(MarbleType type); MarbleType getType(); boolean isCompatible(Marble other);  }### Answer:
@Test public void isCompatibleSameColour() { Marble greenMarble1 = new Marble(MarbleType.GREEN); Marble greenMarble2 = new Marble(MarbleType.GREEN); assertThat(greenMarble1.isCompatible(greenMarble2)).isTrue(); }
@Test public void isIncompatibleDifferentColour() { Marble green = new Marble(MarbleType.GREEN); Marble blue = new Marble(MarbleType.BLUE); assertThat(green.isCompatible(blue)).isFalse(); }
@Test public void isCompatibleJokerFirst() { Marble joker = new Marble(MarbleType.JOKER); Marble greenMarble = new Marble(MarbleType.GREEN); assertThat(joker.isCompatible(greenMarble)).isTrue(); }
@Test public void isCompatibleJokerSecond() { Marble joker = new Marble(MarbleType.JOKER); Marble greenMarble = new Marble(MarbleType.GREEN); assertThat(greenMarble.isCompatible(joker)).isTrue(); }
@Test public void isCompatibleBothJokers() { Marble joker1 = new Marble(MarbleType.JOKER); Marble joker2 = new Marble(MarbleType.JOKER); assertThat(joker1.isCompatible(joker2)).isTrue(); }
@Test public void isCompatibleNull() { Marble joker = new Marble(MarbleType.JOKER); assertThat(joker.isCompatible(null)).isFalse(); }