@Test(expected=IllegalArgumentException.class) public void testTooShort() { CreditCardDisguise.disguise("12345"); }
public static String disguise(String cardNum) { int n = cardNum.length(); if (n < 12 || n > 20) { throw new IllegalArgumentException("Card Number length must be in (12,20}: " + cardNum); } return xxxs.substring(0, n - 4) + cardNum.substring(n - 4); }
CreditCardDisguise { public static String disguise(String cardNum) { int n = cardNum.length(); if (n < 12 || n > 20) { throw new IllegalArgumentException("Card Number length must be in (12,20}: " + cardNum); } return xxxs.substring(0, n - 4) + cardNum.substring(n - 4); } }
CreditCardDisguise { public static String disguise(String cardNum) { int n = cardNum.length(); if (n < 12 || n > 20) { throw new IllegalArgumentException("Card Number length must be in (12,20}: " + cardNum); } return xxxs.substring(0, n - 4) + cardNum.substring(n - 4); }  }
CreditCardDisguise { public static String disguise(String cardNum) { int n = cardNum.length(); if (n < 12 || n > 20) { throw new IllegalArgumentException("Card Number length must be in (12,20}: " + cardNum); } return xxxs.substring(0, n - 4) + cardNum.substring(n - 4); }  static String disguise(String cardNum); }
CreditCardDisguise { public static String disguise(String cardNum) { int n = cardNum.length(); if (n < 12 || n > 20) { throw new IllegalArgumentException("Card Number length must be in (12,20}: " + cardNum); } return xxxs.substring(0, n - 4) + cardNum.substring(n - 4); }  static String disguise(String cardNum);  }