maven-doxia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vsive...@apache.org
Subject svn commit: r500547 - in /maven/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/validation: ./ AdvicedSinkTest.java HangingElemementAdvisorFactoryTest.java
Date Sat, 27 Jan 2007 15:28:24 GMT
Author: vsiveton
Date: Sat Jan 27 07:28:24 2007
New Revision: 500547

URL: http://svn.apache.org/viewvc?view=rev&rev=500547
Log:
DOXIA-27: sink validation (sink advisor)
Submitted by: Juan F. Codagnone
Reviewed by: Vincent Siveton

o Added miss test cases (for r349241)
o Applied with new license header

Added:
    maven/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/validation/
    maven/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/validation/AdvicedSinkTest.java
  (with props)
    maven/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/validation/HangingElemementAdvisorFactoryTest.java
  (with props)

Added: maven/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/validation/AdvicedSinkTest.java
URL: http://svn.apache.org/viewvc/maven/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/validation/AdvicedSinkTest.java?view=auto&rev=500547
==============================================================================
--- maven/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/validation/AdvicedSinkTest.java
(added)
+++ maven/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/validation/AdvicedSinkTest.java
Sat Jan 27 07:28:24 2007
@@ -0,0 +1,60 @@
+package org.apache.maven.doxia.validation;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.doxia.sink.Sink;
+import org.apache.maven.doxia.sink.SinkAdapter;
+import org.apache.maven.doxia.validation.advices.MethodBeforeAdvice;
+
+import junit.framework.TestCase;
+
+/**
+ * unit test
+ *
+ * @author Juan F. Codagnone
+ * @since Nov 6, 2005
+ */
+public class AdvicedSinkTest
+    extends TestCase
+{
+
+    /** unit test */
+    public void testException()
+    {
+        final Sink sink = new AdvicedSink( new MethodBeforeAdvice[] {}, new SinkAdapter()
+        {
+            /** @see org.apache.maven.doxia.sink.SinkAdapter#anchor(java.lang.String) */
+            public void anchor( String arg0 )
+            {
+                throw new IllegalArgumentException( "foo" );
+            }
+        } );
+
+        try
+        {
+            sink.anchor( "ok" );
+            fail();
+        }
+        catch ( final IllegalArgumentException e )
+        {
+            assertEquals( e.getMessage(), "foo" );
+        }
+    }
+}

Propchange: maven/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/validation/AdvicedSinkTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/validation/AdvicedSinkTest.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/validation/HangingElemementAdvisorFactoryTest.java
URL: http://svn.apache.org/viewvc/maven/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/validation/HangingElemementAdvisorFactoryTest.java?view=auto&rev=500547
==============================================================================
--- maven/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/validation/HangingElemementAdvisorFactoryTest.java
(added)
+++ maven/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/validation/HangingElemementAdvisorFactoryTest.java
Sat Jan 27 07:28:24 2007
@@ -0,0 +1,87 @@
+package org.apache.maven.doxia.validation;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import junit.framework.TestCase;
+
+import org.apache.maven.doxia.sink.Sink;
+import org.apache.maven.doxia.sink.SinkAdapter;
+import org.apache.maven.doxia.validation.advices.HangingElementAdvice;
+import org.apache.maven.doxia.validation.advices.MethodBeforeAdvice;
+
+/**
+ * Unit test for
+ * {@link org.apache.maven.doxia.validation.advices.HangingElemementAdvisorFactory}
+ *
+ * @author Juan F. Codagnone
+ * @since Nov 6, 2005
+ */
+public class HangingElemementAdvisorFactoryTest
+    extends TestCase
+{
+
+    /** unit test */
+    public final void testOk()
+    {
+        final Sink sink = new AdvicedSink( new MethodBeforeAdvice[] { new HangingElementAdvice(),
}, new SinkAdapter() );
+
+        sink.text( "foo" );
+        sink.paragraph();
+        sink.list();
+        sink.list_();
+        sink.paragraph_();
+    }
+
+    /** unit test */
+    public final void testWrongOrder()
+    {
+        final Sink sink = new AdvicedSink( new MethodBeforeAdvice[] { new HangingElementAdvice(),
}, new SinkAdapter() );
+
+        sink.paragraph();
+        sink.list();
+        try
+        {
+            sink.paragraph_();
+            fail();
+        }
+        catch ( final IllegalStateException e )
+        {
+            // ok
+        }
+    }
+
+    /** unit test */
+    public final void testHanging()
+    {
+        final Sink sink = new AdvicedSink( new MethodBeforeAdvice[] { new HangingElementAdvice(),
}, new SinkAdapter() );
+
+        sink.paragraph();
+        sink.paragraph_();
+        try
+        {
+            sink.paragraph_();
+            fail();
+        }
+        catch ( final IllegalStateException e )
+        {
+            // ok
+        }
+    }
+}

Propchange: maven/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/validation/HangingElemementAdvisorFactoryTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/doxia/trunk/doxia-core/src/test/java/org/apache/maven/doxia/validation/HangingElemementAdvisorFactoryTest.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"



Mime
View raw message