@Test public void testNotExist() { String url = "http: Assert.assertNull(URLService.notExist(url)); url = "www.google.com"; Assert.assertEquals( String.format(I18n.get(IExceptionMessage.URL_SERVICE_2), url), URLService.notExist(url)); url = "http: Assert.assertEquals( String.format(I18n.get(IExceptionMessage.URL_SERVICE_3), url), URLService.notExist(url)); }
public static String notExist(String url) { if (Strings.isNullOrEmpty(url)) { return I18n.get(IExceptionMessage.URL_SERVICE_1); } try { URL fileURL = new URL(url); fileURL.openConnection().connect(); return null; } catch (java.net.MalformedURLException ex) { ex.printStackTrace(); return String.format(I18n.get(IExceptionMessage.URL_SERVICE_2), url); } catch (java.io.IOException ex) { ex.printStackTrace(); return String.format(I18n.get(IExceptionMessage.URL_SERVICE_3), url); } }
URLService { public static String notExist(String url) { if (Strings.isNullOrEmpty(url)) { return I18n.get(IExceptionMessage.URL_SERVICE_1); } try { URL fileURL = new URL(url); fileURL.openConnection().connect(); return null; } catch (java.net.MalformedURLException ex) { ex.printStackTrace(); return String.format(I18n.get(IExceptionMessage.URL_SERVICE_2), url); } catch (java.io.IOException ex) { ex.printStackTrace(); return String.format(I18n.get(IExceptionMessage.URL_SERVICE_3), url); } } }
URLService { public static String notExist(String url) { if (Strings.isNullOrEmpty(url)) { return I18n.get(IExceptionMessage.URL_SERVICE_1); } try { URL fileURL = new URL(url); fileURL.openConnection().connect(); return null; } catch (java.net.MalformedURLException ex) { ex.printStackTrace(); return String.format(I18n.get(IExceptionMessage.URL_SERVICE_2), url); } catch (java.io.IOException ex) { ex.printStackTrace(); return String.format(I18n.get(IExceptionMessage.URL_SERVICE_3), url); } }  }
URLService { public static String notExist(String url) { if (Strings.isNullOrEmpty(url)) { return I18n.get(IExceptionMessage.URL_SERVICE_1); } try { URL fileURL = new URL(url); fileURL.openConnection().connect(); return null; } catch (java.net.MalformedURLException ex) { ex.printStackTrace(); return String.format(I18n.get(IExceptionMessage.URL_SERVICE_2), url); } catch (java.io.IOException ex) { ex.printStackTrace(); return String.format(I18n.get(IExceptionMessage.URL_SERVICE_3), url); } }  static String notExist(String url); static void fileUrl(
      File file, String fAddress, String localFileName, String destinationDir); static File fileDownload(String fAddress, String destinationDir, String fileName); static void fileDownload(
      File file, String fAddress, String destinationDir, String fileName); }
URLService { public static String notExist(String url) { if (Strings.isNullOrEmpty(url)) { return I18n.get(IExceptionMessage.URL_SERVICE_1); } try { URL fileURL = new URL(url); fileURL.openConnection().connect(); return null; } catch (java.net.MalformedURLException ex) { ex.printStackTrace(); return String.format(I18n.get(IExceptionMessage.URL_SERVICE_2), url); } catch (java.io.IOException ex) { ex.printStackTrace(); return String.format(I18n.get(IExceptionMessage.URL_SERVICE_3), url); } }  static String notExist(String url); static void fileUrl(
      File file, String fAddress, String localFileName, String destinationDir); static File fileDownload(String fAddress, String destinationDir, String fileName); static void fileDownload(
      File file, String fAddress, String destinationDir, String fileName);  }