### Question:
PhoneUtil { public static String hiddenMiddlePhoneNum(String phoneNumber) throws IOException { if (!isPhoneNumber(phoneNumber)) { throw new IOException("phoneNumber invalid"); } return phoneNumber.replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2"); }  @SuppressLint("HardwareIds") static String getIMEI(Context context); @SuppressLint("HardwareIds") static String getIMSI(Context context); static String hiddenMiddlePhoneNum(String phoneNumber); static boolean isPhoneNumber(String phoneNumber);  }### Answer:
@Test public void hiddenMiddlePhoneNum() throws Exception { String hiddenPhoneNumber = PhoneUtil.hiddenMiddlePhoneNum("13634429866"); Assert.assertEquals("", "136****9866", hiddenPhoneNumber); }
@Test(expected = IOException.class) public void testErrorPhoneNumber() throws Exception { String hiddenPhoneNumber = PhoneUtil.hiddenMiddlePhoneNum("1363442986"); Assert.assertEquals("", "136****986", hiddenPhoneNumber); }