@Test public void testFormatPhoneNumber(){ String number = "0244000000"; String expResult = "233244000000"; instance.setDefaultCountryCode("233"); instance.setLocalNumberExpression("0[0-9]{9}"); String result = instance.formatPhoneNumber(number); assertEquals(result, expResult); number = "1234567890"; result = instance.formatPhoneNumber(number); assertEquals(number, result); number = "01234567890"; result = instance.formatPhoneNumber(number); assertEquals(number, result); }
public String formatPhoneNumber( String requesterPhone) { if (requesterPhone == null || requesterPhone.isEmpty()) { return null; } String formattedNumber = requesterPhone; if (Pattern.matches(localNumberExpression, requesterPhone)) { formattedNumber = defaultCountryCode + requesterPhone.substring(1); } return formattedNumber; }
IMPServiceImpl implements IMPService { public String formatPhoneNumber( String requesterPhone) { if (requesterPhone == null || requesterPhone.isEmpty()) { return null; } String formattedNumber = requesterPhone; if (Pattern.matches(localNumberExpression, requesterPhone)) { formattedNumber = defaultCountryCode + requesterPhone.substring(1); } return formattedNumber; } }
IMPServiceImpl implements IMPService { public String formatPhoneNumber( String requesterPhone) { if (requesterPhone == null || requesterPhone.isEmpty()) { return null; } String formattedNumber = requesterPhone; if (Pattern.matches(localNumberExpression, requesterPhone)) { formattedNumber = defaultCountryCode + requesterPhone.substring(1); } return formattedNumber; }  }
IMPServiceImpl implements IMPService { public String formatPhoneNumber( String requesterPhone) { if (requesterPhone == null || requesterPhone.isEmpty()) { return null; } String formattedNumber = requesterPhone; if (Pattern.matches(localNumberExpression, requesterPhone)) { formattedNumber = defaultCountryCode + requesterPhone.substring(1); } return formattedNumber; }  @SuppressWarnings("unchecked") IncomingMessageResponse processRequest(String message, String requesterPhone, boolean isDemo); String processRequest(String message); ArrayList<String> processXForms(ArrayList<String> xForms); String processXForm(String xForm); String formatPhoneNumber(
            String requesterPhone); CoreManager getCoreManager(); void setCoreManager(CoreManager coreManager); IncomingMessageParser getParser(); void setParser(IncomingMessageParser parser); Map<String, CommandAction> getCmdActionMap(); void setCmdActionMap(Map<String, CommandAction> cmdActionMap); IMPManager getImpManager(); void setImpManager(IMPManager impManager); IncomingMessageXMLParser getXmlParser(); void setXmlParser(IncomingMessageXMLParser xmlParser); String getFormProcessSuccess(); void setFormProcessSuccess(String formProcessSuccess); void setOmiManager(OMIManager omiManager); void setMaxConcat(int maxConcat); void setCharsPerSMS(int charsPerSMS); void setConcatAllowance(int concatAllowance); void setMaxSMS(int maxSMS); void setLocalNumberExpression(String localNumberExpression); void setDefaultCountryCode(String defaultCountryCode); void setMessageRegistry(MessageRegistry messageRegistry); }
IMPServiceImpl implements IMPService { public String formatPhoneNumber( String requesterPhone) { if (requesterPhone == null || requesterPhone.isEmpty()) { return null; } String formattedNumber = requesterPhone; if (Pattern.matches(localNumberExpression, requesterPhone)) { formattedNumber = defaultCountryCode + requesterPhone.substring(1); } return formattedNumber; }  @SuppressWarnings("unchecked") IncomingMessageResponse processRequest(String message, String requesterPhone, boolean isDemo); String processRequest(String message); ArrayList<String> processXForms(ArrayList<String> xForms); String processXForm(String xForm); String formatPhoneNumber(
            String requesterPhone); CoreManager getCoreManager(); void setCoreManager(CoreManager coreManager); IncomingMessageParser getParser(); void setParser(IncomingMessageParser parser); Map<String, CommandAction> getCmdActionMap(); void setCmdActionMap(Map<String, CommandAction> cmdActionMap); IMPManager getImpManager(); void setImpManager(IMPManager impManager); IncomingMessageXMLParser getXmlParser(); void setXmlParser(IncomingMessageXMLParser xmlParser); String getFormProcessSuccess(); void setFormProcessSuccess(String formProcessSuccess); void setOmiManager(OMIManager omiManager); void setMaxConcat(int maxConcat); void setCharsPerSMS(int charsPerSMS); void setConcatAllowance(int concatAllowance); void setMaxSMS(int maxSMS); void setLocalNumberExpression(String localNumberExpression); void setDefaultCountryCode(String defaultCountryCode); void setMessageRegistry(MessageRegistry messageRegistry);  }