Author: julien(a)jboss.com
Date: 2007-10-18 20:48:05 -0400 (Thu, 18 Oct 2007)
New Revision: 8710
Added:
modules/test/trunk/tooling/src/main/org/jboss/test/unit/tooling/AssertKeywordTest.java
modules/test/trunk/tooling/src/resources/test/assertkeyword-unit.xml
Modified:
modules/test/trunk/tooling/build.xml
modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/TestsType.java
Log:
by default enable assertions in ant task in order to report errors generated by assert
keywords
Modified: modules/test/trunk/tooling/build.xml
===================================================================
--- modules/test/trunk/tooling/build.xml 2007-10-18 23:31:25 UTC (rev 8709)
+++ modules/test/trunk/tooling/build.xml 2007-10-19 00:48:05 UTC (rev 8710)
@@ -224,6 +224,9 @@
<exclude id="otherTestTwo"/>
</tests>
+ <tests config="./output/resources/test/assertkeyword-unit.xml">
+ </tests>
+
<!--<tests config="./output/resources/test/bobo-tests.xml">
<include id="testOne"/>
<include id="otherTestOne"/>
Added:
modules/test/trunk/tooling/src/main/org/jboss/test/unit/tooling/AssertKeywordTest.java
===================================================================
---
modules/test/trunk/tooling/src/main/org/jboss/test/unit/tooling/AssertKeywordTest.java
(rev 0)
+++
modules/test/trunk/tooling/src/main/org/jboss/test/unit/tooling/AssertKeywordTest.java 2007-10-19
00:48:05 UTC (rev 8710)
@@ -0,0 +1,38 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.test.unit.tooling;
+
+import org.jboss.unit.api.pojo.annotations.Test;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class AssertKeywordTest
+{
+ @Test
+ public void test()
+ {
+ assert false : "This test should fail";
+ }
+}
Modified: modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/TestsType.java
===================================================================
---
modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/TestsType.java 2007-10-18
23:31:25 UTC (rev 8709)
+++
modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/TestsType.java 2007-10-19
00:48:05 UTC (rev 8710)
@@ -26,6 +26,7 @@
import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Environment;
+import org.apache.tools.ant.types.Assertions;
import org.apache.tools.ant.taskdefs.Java;
import static org.jboss.unit.tooling.ant.ToolingConstants.*;
@@ -68,7 +69,6 @@
private Set<Environment.Variable> sysproperties = new
HashSet<Environment.Variable>();
-
public TestsType()
{
}
@@ -124,6 +124,12 @@
julProperty.setValue("logging.properties");
javaTask.addSysproperty(julProperty);
+ // We enable by default all assertions : todo make it configurable perhaps (see
JDK doc about assertions)
+ Assertions assertions = new Assertions();
+ assertions.setProject(getProject());
+ assertions.addEnable(new Assertions.EnabledAssertion());
+ javaTask.addAssertions(assertions);
+
// Beginning of jpda option implementation, need to improve it
if (jpda)
{
Copied: modules/test/trunk/tooling/src/resources/test/assertkeyword-unit.xml (from rev
8705, modules/test/trunk/tooling/src/resources/test/bobo-tests.xml)
===================================================================
--- modules/test/trunk/tooling/src/resources/test/assertkeyword-unit.xml
(rev 0)
+++ modules/test/trunk/tooling/src/resources/test/assertkeyword-unit.xml 2007-10-19
00:48:05 UTC (rev 8710)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jboss-unit
+ xmlns="urn:jboss:jboss-unit:1.0"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:jboss-unit:1.0 jboss-unit_1_0.xsd">
+ <pojo>
+ <test>
+ <class name="org.jboss.test.unit.tooling.AssertKeywordTest"/>
+ </test>
+ </pojo>
+</jboss-unit>
\ No newline at end of file