我有一个@Test脚本设置,它运行一些soft asserts.
但是,我遇到了assertAll. 我希望URLs在assertAll. 这是可能的还是另一种推荐的方法?
@Test
public static void checkUrl(String requestUrl, String expectedUrl){
SoftAssert softAssert = new SoftAssert ();
try {
URL obj = new URL(requestUrl);
HttpURLConnection conn = (HttpURLConnection) obj.openConnection();
conn.setReadTimeout(5000);
conn.addRequestProperty("Accept-Language", "en-US,en;q=0.8");
conn.addRequestProperty("User-Agent", "Mozilla");
conn.addRequestProperty("Referer", "google.com");
System.out.println();
System.out.println("Request URL ... " + requestUrl);
boolean redirect = false;
// normally, 3xx is redirect
int status = conn.getResponseCode();
if (status != HttpURLConnection.HTTP_OK) {
if (status == HttpURLConnection.HTTP_MOVED_TEMP
|| status == …Run Code Online (Sandbox Code Playgroud)