package net.jaekl.frank;
-import java.io.ByteArrayOutputStream;
-import java.io.PrintWriter;
-import java.sql.SQLException;
import java.util.HashMap;
-import java.util.Locale;
-import net.jaekl.qd.QDException;
import net.jaekl.qd.http.HttpServletRequestMock;
import org.junit.Assert;
value = vs.getParamString(reqMock, "notPresent");
Assert.assertEquals(null, value);
}
-
- @Test
- public void testWriteErrorPage() {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- PrintWriter pw = new PrintWriter(baos);
-
- ViewSchedule vs = new ViewSchedule();
-
- Throwable[] throwables = {
- new NullPointerException(),
- new QDException(),
- new SQLException()
- };
-
- for (Throwable t : throwables) {
- baos.reset();
- vs.writeErrorPage(pw, t, Locale.CANADA); // TODO: test translations
- pw.flush();
-
- String actual = baos.toString();
- Assert.assertTrue(actual.contains("<TITLE>Frank: Error Page</TITLE>"));
- Assert.assertTrue(actual.contains(t.toString()));
- }
- }
-
}