ConnexionInternetStatus { public boolean isConnectionAvailable() { boolean status = false; try { URL url = new URL("https: HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.connect(); System.out.println("response code "+con.getResponseCode()+" message "+con.getResponseMessage()); if (con.getResponseCode() == 200) { status = true; } } catch (MalformedURLException ex) { Logger.getLogger(ConnexionInternetStatus.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(ConnexionInternetStatus.class.getName()).log(Level.SEVERE, null, ex); } return status; }  boolean isConnectionAvailable();  }
@Test public void testIsConnectionAvailable() { System.out.println("isConnectionAvailable"); ConnexionInternetStatus instance = new ConnexionInternetStatus(); boolean expResult = true; boolean result = instance.isConnectionAvailable(); assertEquals(expResult, result); }