[webbeans-commits] Webbeans SVN: r1404 - tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/report.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Tue Feb 3 23:38:21 EST 2009


Author: shane.bryzak at jboss.com
Date: 2009-02-03 23:38:21 -0500 (Tue, 03 Feb 2009)
New Revision: 1404

Modified:
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/report/AuditParser.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/report/CoverageReport.java
Log:
unmatched tests

Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/report/AuditParser.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/report/AuditParser.java	2009-02-04 04:10:08 UTC (rev 1403)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/report/AuditParser.java	2009-02-04 04:38:21 UTC (rev 1404)
@@ -65,6 +65,24 @@
    }
    
    /**
+    * 
+    * @param sectionId
+    * @param assertionId
+    * @return
+    */
+   public boolean hasAssertion(String sectionId, String assertionId)
+   {
+      if (!assertions.containsKey(sectionId)) return false;
+      
+      for (AuditAssertion assertion : assertions.get(sectionId))
+      {
+         if (assertion.getId().equals(assertionId)) return true;
+      }
+      
+      return false;
+   }
+   
+   /**
     * Load the spec assertions defined in tck-audit.xml 
     */
    public void parse() throws Exception

Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/report/CoverageReport.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/report/CoverageReport.java	2009-02-04 04:10:08 UTC (rev 1403)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/report/CoverageReport.java	2009-02-04 04:38:21 UTC (rev 1404)
@@ -162,14 +162,52 @@
    
    private void writeUnmatched(OutputStream out) throws IOException
    {
+      List<SpecReference> unmatched = new ArrayList<SpecReference>();
+      
+      for (String sectionId : references.keySet())
+      {
+         for (SpecReference ref : references.get(sectionId))
+         {
+            if (!auditParser.hasAssertion(ref.getSection(), ref.getAssertion()))
+            {
+               unmatched.add(ref);
+            }
+         }         
+      }
+      
+      if (unmatched.isEmpty()) return;
+      
       StringBuilder sb = new StringBuilder();
       
       sb.append("<h3>Unmatched tests</h3>\n");
       sb.append("<p>The following tests do not match any known assertions</p>");
-      
-      sb.append("<table>\n");
+            
+      sb.append("<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n");
       sb.append("  <tr><th>Section</th><th>Assertion</th><th>Test Class</th><th>Test Method</th></tr>\n");
       
+      for (SpecReference ref : unmatched)
+      {
+         sb.append("<tr>");
+         
+         sb.append("<td>");
+         sb.append(ref.getSection());
+         sb.append("</td>");
+
+         sb.append("<td>");
+         sb.append(ref.getAssertion());
+         sb.append("</td>");
+         
+         sb.append("<td>");
+         sb.append(ref.getClassName());
+         sb.append("</td>");
+         
+         sb.append("<td>");
+         sb.append(ref.getMethodName());
+         sb.append("()");
+         sb.append("</td>");
+         
+         sb.append("</tr>");
+      }
       
       sb.append("</table>");
       




More information about the weld-commits mailing list