org.framework.utils.ResponseCheck Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of WebAppFramework-CucumberJVM-Junit Show documentation
Show all versions of WebAppFramework-CucumberJVM-Junit Show documentation
A jar to include in your test setup that drives the cucumber jvm tests. Facilitates in executing the cucumber
tests in parallel. Contains libraries such as to read from Excel, random generator etc.
The newest version!
package org.framework.utils;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
public class ResponseCheck {
/*
* @author Hemanth.Sridhar
*/
public int getResponseCode(String urlString) throws MalformedURLException, IOException{
URL url = new URL(urlString);
HttpURLConnection huc = (HttpURLConnection)url.openConnection();
huc.setRequestMethod("GET");
huc.connect();
return huc.getResponseCode();
}
}