rfscholte commented on a change in pull request #286: [MNG-6656] Introduce base 
for build/consumer process
URL: https://github.com/apache/maven/pull/286#discussion_r386607205
 
 

 ##########
 File path: 
maven-xml/src/test/java/org/apache/maven/xml/sax/filter/ReactorDependencyXMLFilterTest.java
 ##########
 @@ -0,0 +1,145 @@
+package org.apache.maven.xml.sax.filter;
+
+/*
+ * 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 static org.xmlunit.assertj.XmlAssert.assertThat;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.TransformerException;
+
+import org.junit.Test;
+import org.xml.sax.SAXException;
+
+public class ReactorDependencyXMLFilterTest extends AbstractXMLFilterTests
+{
+    @Override
+    protected ReactorDependencyXMLFilter getFilter()
+        throws TransformerException, SAXException, ParserConfigurationException
+    {
+        return new ReactorDependencyXMLFilter( (g, a) -> "1.0.0" );
+    }
+
+    @Test
+    public void testDefaultDependency() throws Exception
+    {
+        String input = "<dependency>"
+            + "<groupId>GROUPID</groupId>"
+            + "<artifactId>ARTIFACTID</artifactId>"
+            + "<version>VERSION</version>"
+            + "</dependency>";
+        String expected = input;
+        
+        String actual = transform( input );
+        
+        assertThat( actual ).isEqualTo( expected );
+    }
+
+    @Test
+    public void testManagedDependency() throws Exception
+    {
+        ReactorDependencyXMLFilter filter = new ReactorDependencyXMLFilter( 
(g, a) -> null );
+        
+        String input = "<dependency>"
+            + "<groupId>GROUPID</groupId>"
+            + "<artifactId>ARTIFACTID</artifactId>"
+            + "</dependency>";
+        String expected = input;
+        
+        String actual = transform( input, filter );
+        
+        assertThat( actual ).isEqualTo( expected );
+    }
+
+    @Test
+    public void testReactorDependency() throws Exception
+    {
+        String input = "<dependency>"
+                        + "<groupId>GROUPID</groupId>"
+                        + "<artifactId>ARTIFACTID</artifactId>"
+                        + "</dependency>";
+        String expected = "<dependency>"
+                        + "<groupId>GROUPID</groupId>"
+                        + "<artifactId>ARTIFACTID</artifactId>"
+                        + "<version>1.0.0</version>"
+                        + "</dependency>";
+        
+        String actual = transform( input );
+        
+        assertThat( actual ).isEqualTo( expected );
+    }
+
+    @Test
+    public void testReactorDependencyLF() throws Exception
 
 Review comment:
   This test is about adding the version in the expected position, respecting 
proper line ending and indents. Checking if `<version>1.0</version>` was added 
was already done in the previous test.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to