提交 6b633051 authored 作者: Thomas Mueller's avatar Thomas Mueller

Improve code coverage.

上级 f84b4a92
......@@ -142,7 +142,16 @@ public class TestWeb extends TestBase {
result = client.get(url);
client.readSessionId(result);
result = client.get(url, "login.jsp");
assertEquals("text/html", client.getContentType());
assertContains(result, "Einstellung");
client.get(url, "favicon.ico");
assertEquals("image/x-icon", client.getContentType());
client.get(url, "ico_ok.gif");
assertEquals("image/gif", client.getContentType());
client.get(url, "tree.js");
assertEquals("text/javascript", client.getContentType());
client.get(url, "stylesheet.css");
assertEquals("text/css", client.getContentType());
client = new WebClient();
result = client.get(url);
......
......@@ -22,6 +22,7 @@ public class WebClient {
private String sessionId;
private String acceptLanguage;
private String contentType;
/**
* Open an URL and get the HTML data.
......@@ -38,6 +39,7 @@ public class WebClient {
}
conn.connect();
int code = conn.getResponseCode();
contentType = conn.getContentType();
if (code != HttpURLConnection.HTTP_OK) {
throw new IOException("Result code: " + code);
}
......@@ -78,6 +80,10 @@ public class WebClient {
this.acceptLanguage = acceptLanguage;
}
String getContentType() {
return contentType;
}
/**
* Read the session ID from a URL.
*
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论