### Question:
CardUtils { @NonNull @Card.CardBrand public static String getPossibleCardType(@Nullable String cardNumber) { return getPossibleCardType(cardNumber, true); }  @NonNull @Card.CardBrand static String getPossibleCardType(@Nullable String cardNumber); static boolean isValidCardNumber(@Nullable String cardNumber);  }### Answer:
@Test public void getPossibleCardType_withEmptyCard_returnsUnknown() { assertEquals(Card.UNKNOWN, CardUtils.getPossibleCardType(" ")); }
@Test public void getPossibleCardType_withNullCardNumber_returnsUnknown() { assertEquals(Card.UNKNOWN, CardUtils.getPossibleCardType(null)); }
@Test public void getPossibleCardType_withVisaPrefix_returnsVisa() { assertEquals(Card.VISA, CardUtils.getPossibleCardType("4899 99")); assertEquals(Card.VISA, CardUtils.getPossibleCardType("4")); }
@Test public void getPossibleCardType_withAmexPrefix_returnsAmex() { assertEquals(Card.AMERICAN_EXPRESS, CardUtils.getPossibleCardType("345")); assertEquals(Card.AMERICAN_EXPRESS, CardUtils.getPossibleCardType("37999999999")); }
@Test public void getPossibleCardType_withJCBPrefix_returnsJCB() { assertEquals(Card.JCB, CardUtils.getPossibleCardType("3535 3535")); }
@Test public void getPossibleCardType_withMasterCardPrefix_returnsMasterCard() { assertEquals(Card.MASTERCARD, CardUtils.getPossibleCardType("2222 452")); assertEquals(Card.MASTERCARD, CardUtils.getPossibleCardType("5050")); }
@Test public void getPossibleCardType_withDinersClubPrefix_returnsDinersClub() { assertEquals(Card.DINERS_CLUB, CardUtils.getPossibleCardType("303922 2234")); assertEquals(Card.DINERS_CLUB, CardUtils.getPossibleCardType("36778 9098")); }
@Test public void getPossibleCardType_withDiscoverPrefix_returnsDiscover() { assertEquals(Card.DISCOVER, CardUtils.getPossibleCardType("60355")); assertEquals(Card.DISCOVER, CardUtils.getPossibleCardType("62")); assertEquals(Card.DISCOVER, CardUtils.getPossibleCardType("6433 8 90923")); assertEquals(Card.DISCOVER, CardUtils.getPossibleCardType("6523452309209340293423")); }
@Test public void getPossibleCardType_withNonsenseNumber_returnsUnknown() { assertEquals(Card.UNKNOWN, CardUtils.getPossibleCardType("1234567890123456")); assertEquals(Card.UNKNOWN, CardUtils.getPossibleCardType("9999 9999 9999 9999")); assertEquals(Card.UNKNOWN, CardUtils.getPossibleCardType("3")); }