im trying to make test scenario but im getting this error searched other questions before but still didint find and anserw pls help
StepDefs:
@Given("i check if comment exsist")
public void checkPost() throws IOException,URISyntaxException {
final URL url = new URL("http://localhost:3000/comments/" + networkConfigurationProperties.lastPath());
HttpURLConnection huc = (HttpURLConnection) url.openConnection();
int responseCode = huc.getResponseCode();
if (responseCode == 200) {
System.out.println("comment exist");
} else {
System.out.println("comment doesn't exist");
}
}
NetworkConfigurationProperties:
public class NetworkConfigurationProperties {
public void lastPath() throws IOException,URISyntaxException {
final URI uri = new URI("http://localhost:3000/comments/");
String path = uri.getPath();
String idStr = path.substring(path.lastIndexOf('/') + 1);
int id = Integer.parseInt(idStr);
}
Aucun commentaire:
Enregistrer un commentaire