UtilTest.java revision 605
/**
* Test of the methods in <code>org.opensolaris.opengrok.web.Util</code>.
*/
public class UtilTest {
private static Locale savedLocale;
public static void setUpClass() {
// Some of the methods have different results in different locales.
// Set locale to en_US for these tests.
}
public static void tearDownClass() {
savedLocale = null;
}
@Test
public void htmlize() {
String[][] input_output = {
{ "This is a test", "This is a test" },
{ "Newline\nshould become <br/>",
"Newline<br/>should become <br/>" },
{ "Open & Grok", "Open & Grok" },
{ "&<>", "&amp;&lt;&gt;" },
};
// 1 arg
// 2 args
}
}
@Test
public void breadcrumbPath() {
// Are these two correct? Why don't we create links?
assertEquals("<a href=\"/root/xx\">xx</a>",
assertEquals("<a href=\"/r/a\">a</a>/<a href=\"/r/a/b\">b</a>",
assertEquals("<a href=\"/r/a\">a</a>/<a href=\"/r/a/b\">b</a>/",
assertEquals("<a href=\"/r/java\">java</a>." +
assertEquals("<a href=\"/root/xx&project=y\">xx</a>",
assertEquals("<a href=\"/root/xx&project=y\">xx</a>",
assertEquals("<a href=\"/r/\">..</a>/" +
"<a href=\"/r/a\">a</a>/" +
"<a href=\"/r/a/b\">b</a>/" +
"<a href=\"/r/a\">..</a>/" +
"<a href=\"/r/a/c\">c</a>/" +
"/" +
"<a href=\"/r/a/c/d\">d</a>",
}
@Test
public void redableSize() {
assertEquals("<b>8,796,093,022,208M</b>",
}
@Test
public void readableLine() throws Exception {
assertEquals("\n<a class=\"l\" name=\"42\"> 42 </a>",
assertEquals("\n<a class=\"hl\" name=\"110\"> 110 </a>",
}
@Test
public void uid() {
assertEquals("\u0000etc\u0000passwd\u0000date",
}
@Test
public void uid2url() {
}
@Test
public void URIEncode() {
}
@Test
public void URIEncodePath() {
assertEquals("/a//x/yz/%23%23/%20/%20%3F",
}
@Test
public void formQuoteEscape() {
}
@Test
public void buildQueryString() {
}
}