@Override
public void render(RenderRequest portletReq, RenderResponse portletResp)
throws PortletException, IOException {
long tid = Thread.currentThread().getId();
portletReq.setAttribute(THREADID_ATTR, tid);
PrintWriter writer = portletResp.getWriter();
JSR286ApiTestCaseDetails tcd = new JSR286ApiTestCaseDetails();
// Create result objects for the tests
/* TestCase: V2ExceptionTests_ValidatorException_ApiRender_constructor2 */
/* Details: "For ValidatorException(java.lang.String, */
/* java.util.Collection<java.lang.String>), the failedKeys */
/* parameter may be null" */
TestResult tr0 =
tcd.getTestResultFailed(V2EXCEPTIONTESTS_VALIDATOREXCEPTION_APIRENDER_CONSTRUCTOR2);
ValidatorException ve = new ValidatorException("TestException", null);
if (ve.getMessage().equals("TestException")) {
tr0.setTcSuccess(true);
}
tr0.writeTo(writer);
/* TestCase: V2ExceptionTests_ValidatorException_ApiRender_constructor4 */
/* Details: "For ValidatorException(java.lang.String, */
/* java.lang.Throwable, */
/* java.util.Collection<java.lang.String>), the failedKeys */
/* parameter may be null" */
TestResult tr1 =
tcd.getTestResultFailed(V2EXCEPTIONTESTS_VALIDATOREXCEPTION_APIRENDER_CONSTRUCTOR4);
Throwable tw = new Throwable("TestThrow");
ValidatorException ve1 = new ValidatorException("TestException1", tw, null);
if (ve1.getMessage().equals("TestException1")) {
tr1.setTcSuccess(true);
}
tr1.writeTo(writer);
/* TestCase: V2ExceptionTests_ValidatorException_ApiRender_constructor6 */
/* Details: "For ValidatorException(java.lang.Throwable, */
/* java.util.Collection<java.lang.String>), the failedKeys */
/* parameter may be null" */
TestResult tr2 =
tcd.getTestResultFailed(V2EXCEPTIONTESTS_VALIDATOREXCEPTION_APIRENDER_CONSTRUCTOR6);
Throwable tw1 = new Throwable("TestThrow1");
ValidatorException ve2 = new ValidatorException(tw1, null);
if (ve2.getMessage().contains("TestThrow1")) {
tr2.setTcSuccess(true);
}
tr2.writeTo(writer);
/* TestCase: V2ExceptionTests_ValidatorException_ApiRender_getFailedKeys1 */
/* Details: "Method getFailedKeys(): Returns a */
/* java.util.Enumeration<java.lang.String> object containing */
/* the preference keys that failed validation" */
TestResult tr3 =
tcd.getTestResultFailed(V2EXCEPTIONTESTS_VALIDATOREXCEPTION_APIRENDER_GETFAILEDKEYS1);
tr3.setTcSuccess(true);
tr3.appendTcDetail("There are no Preference Keys that Failed Validation in this Test Portlet.");
tr3.writeTo(writer);
/* TestCase: V2ExceptionTests_ValidatorException_ApiRender_getFailedKeys2 */
/* Details: "Method getFailedKeys(): Returns an empty enmueration if */
/* no failed keys are available" */
TestResult tr4 =
tcd.getTestResultFailed(V2EXCEPTIONTESTS_VALIDATOREXCEPTION_APIRENDER_GETFAILEDKEYS2);
Enumeration<?> eu = ve1.getFailedKeys();
List<?> li = Collections.list(eu);
if (li.isEmpty()) {
tr4.setTcSuccess(true);
}
tr4.writeTo(writer);
}
ExceptionTests_ValidatorException_ApiRender.java 文件源码
java
阅读 28
收藏 0
点赞 0
评论 0
项目:portals-pluto
作者:
评论列表
文章目录