### Question:
StripeTextUtils { @Nullable public static String removeSpacesAndHyphens(@Nullable String cardNumberWithSpaces) { if (isBlank(cardNumberWithSpaces)) { return null; } return cardNumberWithSpaces.replaceAll("\\s|-", ""); }  @Nullable static String nullIfBlank(@Nullable String value); static boolean isBlank(@Nullable String value); @Nullable static String removeSpacesAndHyphens(@Nullable String cardNumberWithSpaces);  }### Answer:
@Test public void removeSpacesAndHyphens_withSpacesInInterior_returnsSpacelessNumber() { String testCardNumber = "4242 4242 4242 4242"; assertEquals("4242424242424242", StripeTextUtils.removeSpacesAndHyphens(testCardNumber)); }
@Test public void removeSpacesAndHyphens_withExcessiveSpacesInInterior_returnsSpacelessNumber() { String testCardNumber = "4 242 4 242 4 242 42 4 2"; assertEquals("4242424242424242", StripeTextUtils.removeSpacesAndHyphens(testCardNumber)); }
@Test public void removeSpacesAndHyphens_withSpacesOnExterior_returnsSpacelessNumber() { String testCardNumber = " 42424242 4242 4242 "; assertEquals("4242424242424242", StripeTextUtils.removeSpacesAndHyphens(testCardNumber)); }
@Test public void removeSpacesAndHyphens_whenEmpty_returnsNull () { assertNull(StripeTextUtils.removeSpacesAndHyphens(" ")); }
@Test public void removeSpacesAndHyphens_whenNull_returnsNull() { assertNull(StripeTextUtils.removeSpacesAndHyphens(null)); }
@Test public void removeSpacesAndHyphens_withHyphenatedCardNumber_returnsCardNumber() { assertEquals("4242424242424242", StripeTextUtils.removeSpacesAndHyphens("4242-4242-4242-4242")); }
@Test public void removeSpacesAndHyphens_removesMultipleSpacesAndHyphens() { assertEquals("123", StripeTextUtils.removeSpacesAndHyphens(" - 1- --- 2 3- - - -------- ")); }