Author: bdaw
Date: 2008-02-27 17:56:58 -0500 (Wed, 27 Feb 2008)
New Revision: 10140
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/Assertion.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/reports/ResultProducingListener.java
Log:
Improve a bit dummy test coverage reporting
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/Assertion.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/Assertion.java 2008-02-27
22:06:45 UTC (rev 10139)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/Assertion.java 2008-02-27
22:56:58 UTC (rev 10140)
@@ -771,7 +771,7 @@
JSR286_130(new TCK(130, "PLT.13.1.7"), "Setting a cachability different
from FULL must result in an " +
"IllegalStateException"),
JSR286_131(new TCK(131, "PLT.13.1.7"), "Attempts to create URLs that
are not of type FULL or are not resource " +
- "URLs in the current or a downstream response must result in\n" +
+ "URLs in the current or a downstream response must result in" +
"an IllegalStateException"),
JSR286_132(new TCK(132, "PLT.13.1.7"), "Creating other URLs, e.g.
resource URLs of type PAGE or action or render " +
"URLs, must result in an IllegalStateException"),
@@ -927,13 +927,13 @@
"getPathTranslated, getQueryString, getRequestURI and getServletPath."),
JSR286_188(new TCK(188, "PLT.19.3.3"), "The following methods of the
HttpServletRequest must be equivalent " +
"to the methods of the PortletRequest of similar name: getScheme,
getServerName, getServerPort, getAttribute, " +
- "getAttributeNames, setAttribute, removeAttribute, getLocale, getLocales,
isSecure, getAuthType,\n" +
+ "getAttributeNames, setAttribute, removeAttribute, getLocale, getLocales,
isSecure, getAuthType," +
"getContextPath, getRemoteUser, getUserPrincipal, getRequestedSessionId,
isRequestedSessionIdValid, getCookies."),
JSR286_189(new TCK(189, "PLT.19.3.3"), "The following methods of the
HttpServletRequest must be equivalent to " +
"the methods of the PortletRequest of similar name with the provision defined
in PLT.19.1.1 Query Strings " +
"in Request Dispatcher Paths Section: getParameter, getParameterNames,
getParameterValues and getParameterMap."),
JSR286_190(new TCK(190, "PLT.19.3.3"), "In case of an include from
processAction, the following methods of the " +
- "HttpServletRequest must be based on the corresponding methods of the\n"
+
+ "HttpServletRequest must be based on the corresponding methods of the" +
"ActionRequest: getCharacterEncoding, setCharacterEncoding, getContentType,
getInputStream, getContentLength, " +
"getMethod and getReader."),
JSR286_191(new TCK(191, "PLT.19.3.3"), "In case of an include from
processEvent, the following methods of the " +
@@ -960,7 +960,7 @@
"to the methods of the ActionResponse/EventResponse of similar name: encodeURL
and encodeUrl."),
JSR286_201(new TCK(201, "PLT.19.3.3"),
Status.specUntestable("impl"), "The following methods of the
HttpServletResponse must perform no " +
"operations: setContentType, setCharacterEncoding, setContentLength,
setLocale, addCookie, sendError, " +
- "sendRedirect, setDateHeader, addDateHeader, setHeader, addHeader,
setIntHeader, addIntHeader, setStatus,\n" +
+ "sendRedirect, setDateHeader, addDateHeader, setHeader, addHeader,
setIntHeader, addIntHeader, setStatus," +
"setBufferSize and flushBuffer."),
JSR286_202(new TCK(202, "PLT.19.3.3"), "The containsHeader method of
the HttpServletResponse must return false."),
JSR286_203(new TCK(203, "PLT.19.3.3"), "The isCommitted method of the
HttpServletResponse must return true."),
@@ -1013,7 +1013,7 @@
"getPathTranslated, getQueryString, getRequestURI and getServletPath."),
JSR286_223(new TCK(223, "PLT.19.3.5"), "The following methods of the
HttpServletRequest must be equivalent " +
"to the methods of the PortletRequest of similar name: getScheme,
getServerName, getServerPort, getAttribute, " +
- "getAttributeNames, setAttribute, removeAttribute, getLocale, getLocales,
isSecure, getAuthType,\n" +
+ "getAttributeNames, setAttribute, removeAttribute, getLocale, getLocales,
isSecure, getAuthType," +
"getContextPath, getRemoteUser, getUserPrincipal, getRequestedSessionId,
isRequestedSessionIdValid, getCookies."),
JSR286_224(new TCK(224, "PLT.19.3.5"), "The following methods of the
HttpServletRequest must be equivalent to " +
"the methods of the ResourceRequest of similar name: getCharacterEncoding,
setCharacterEncoding, getContentType, " +
@@ -1080,7 +1080,7 @@
"methods of the PortletRequest of similar name with the provision defined in
PLT.18.1.1 Query Strings in Request " +
"Dispatcher Paths Section: getParameter, getParameterNames, getParameterValues
and getParameterMap."),
JSR286_248(new TCK(248, "PLT.19.4.3"), "In case of a forward from
processAction, the following methods of the " +
- "HttpServletRequest must be based on the corresponding methods of the\n"
+
+ "HttpServletRequest must be based on the corresponding methods of the" +
"ActionRequest: getCharacterEncoding, setCharacterEncoding, getContentType,
getInputStream, getContentLength, " +
"getMethod and getReader."),
JSR286_249(new TCK(249, "PLT.19.4.3"), "In case of a forward from
processEvent, the following methods of the " +
@@ -1104,7 +1104,7 @@
JSR286_257(new TCK(257, "PLT.19.4.3"), "The following methods of the
HttpServletResponse must be equivalent " +
"to the methods of the ActionResponse/EventResponse of similar name: encodeURL
and encodeUrl."),
JSR286_258(new TCK(258, "PLT.19.4.3"),
Status.specUntestable("imp"), "The following methods of the
HttpServletResponse must perform no " +
- "operations: resetBuffer, reset, setContentType, setContentLength,\n" +
+ "operations: resetBuffer, reset, setContentType, setContentLength," +
"setCharacterEncoding, setLocale, sendError, setDateHeader, addDateHeader,
setHeader, addHeader, setIntHeader, " +
"addIntHeader, setStatus, setBufferSize and flushBuffer."),
JSR286_259(new TCK(259, "PLT.19.4.3"),
Status.specUntestable("impl"), "The addCookie method of the
HttpServletResponse must be based on " +
@@ -1161,7 +1161,7 @@
"getPathTranslated, getQueryString, getRequestURI and getServletPath."),
JSR286_281(new TCK(281, "PLT.19.4.5"), "The following methods of the
HttpServletRequest must be equivalent " +
"to the methods of the PortletRequest of similar name: getScheme,
getServerName, getServerPort, getAttribute, " +
- "getAttributeNames, setAttribute, removeAttribute, getLocale, getLocales,
isSecure, getAuthType, \n" +
+ "getAttributeNames, setAttribute, removeAttribute, getLocale, getLocales,
isSecure, getAuthType, " +
"getContextPath, getRemoteUser, getUserPrincipal, getRequestedSessionId,
isRequestedSessionIdValid, getCookies."),
JSR286_282(new TCK(282, "PLT.19.4.5"), "The following methods of the
HttpServletRequest must be equivalent to " +
"the methods of the ResourceRequest of similar name: getCharacterEncoding,
setCharacterEncoding, getContentType, getMethod and getReader."),
@@ -1206,7 +1206,7 @@
"container, the portlet container must first call the destroy method on the
filter to enable the filter to " +
"release any resources and perform other cleanup operations."),
JSR286_296(new TCK(296, "PLT.20.2.2"), "When a filter invokes the
doFilter method on the portlet container’s " +
- "filter chain implementation, the container must ensure that the request
and\n" +
+ "filter chain implementation, the container must ensure that the request and
" +
"response object that it passes to the next component in the filter chain, or
to the target portlet if the " +
"filter was the last in the chain, is the same object that was passed into the
doFilter method by the calling " +
"filter or one of the above mentioned wrappers."),
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/reports/ResultProducingListener.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/reports/ResultProducingListener.java 2008-02-27
22:06:45 UTC (rev 10139)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/unit/reports/ResultProducingListener.java 2008-02-27
22:56:58 UTC (rev 10140)
@@ -22,18 +22,15 @@
package org.jboss.portal.unit.reports;
+import com.sun.mirror.apt.RoundCompleteEvent;
import com.sun.mirror.apt.RoundCompleteListener;
-import com.sun.mirror.apt.RoundCompleteEvent;
+import org.jboss.portal.unit.Assertion;
import java.io.File;
+import java.io.FileWriter;
import java.io.Writer;
-import java.io.FileWriter;
+import java.util.Map;
import java.util.Set;
-import java.util.Map;
-import java.util.Collections;
-import java.util.SortedSet;
-import java.util.List;
-import java.util.LinkedList;
/**
* @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
@@ -86,12 +83,16 @@
for (int i = 1; i <= max; i++)
{
- String assertion = pre + i;
+ String assertionName = pre + i;
- writer.write(assertion + ",\n");
+ Set<String> testCases = map.get(assertionName);
- Set<String> testCases = map.get(assertion);
+ Assertion assertion = getAssertion(assertionName);
+ String description = assertion != null ?
assertion.getDescription().replaceAll(",", " ").trim() :
"";
+
+ writer.write(assertionName + ", " + description + '\n');
+
if (testCases != null)
{
for (String testCase : testCases)
@@ -99,9 +100,32 @@
writer.write(" ," + testCase + "\n");
}
}
+
+ writer.write(" ,\n");
}
writer.close();
+ }
+
+ private Assertion getAssertion(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException("name cannot be null");
+ }
+
+ Assertion[] assertions = Assertion.class.getEnumConstants();
+
+ for (Assertion assertion : assertions)
+ {
+ if (assertion.name().equals(name))
+ {
+ return assertion;
+ }
+ }
+
+
+ return null;
}
}