You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kh...@apache.org on 2016/02/08 07:23:30 UTC

svn commit: r1729076 - in /maven/plugins/trunk/maven-resources-plugin: pom.xml src/test/java/org/apache/maven/plugins/resources/BasicPropertyUtilsTest.java src/test/java/org/apache/maven/plugins/resources/PropertyUtilsExceptionTest.java

Author: khmarbaise
Date: Mon Feb  8 06:23:30 2016
New Revision: 1729076

URL: http://svn.apache.org/viewvc?rev=1729076&view=rev
Log:
o Tried to make testing of an exception simpler,
  but unfortunately the AbstractMojoTestCase
  does not seem to support @Test(expected =..).
  Moved the test to a separate JUnit 4 only test
  case where it works.

Added:
    maven/plugins/trunk/maven-resources-plugin/src/test/java/org/apache/maven/plugins/resources/PropertyUtilsExceptionTest.java
Modified:
    maven/plugins/trunk/maven-resources-plugin/pom.xml
    maven/plugins/trunk/maven-resources-plugin/src/test/java/org/apache/maven/plugins/resources/BasicPropertyUtilsTest.java

Modified: maven/plugins/trunk/maven-resources-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-resources-plugin/pom.xml?rev=1729076&r1=1729075&r2=1729076&view=diff
==============================================================================
--- maven/plugins/trunk/maven-resources-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-resources-plugin/pom.xml Mon Feb  8 06:23:30 2016
@@ -149,6 +149,12 @@ under the License.
       <version>2.4</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.12</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <profiles>

Modified: maven/plugins/trunk/maven-resources-plugin/src/test/java/org/apache/maven/plugins/resources/BasicPropertyUtilsTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-resources-plugin/src/test/java/org/apache/maven/plugins/resources/BasicPropertyUtilsTest.java?rev=1729076&r1=1729075&r2=1729076&view=diff
==============================================================================
--- maven/plugins/trunk/maven-resources-plugin/src/test/java/org/apache/maven/plugins/resources/BasicPropertyUtilsTest.java (original)
+++ maven/plugins/trunk/maven-resources-plugin/src/test/java/org/apache/maven/plugins/resources/BasicPropertyUtilsTest.java Mon Feb  8 06:23:30 2016
@@ -114,25 +114,4 @@ public class BasicPropertyUtilsTest
         assertNull( prop.getProperty( "does_not_exist" ) );
     }
 
-    /**
-     * load property test case can be adjusted by modifying the basic.properties and basic_validation properties
-     *
-     * @throws Exception
-     */
-    public void testException()
-        throws Exception
-    {
-        boolean failed = false;
-
-        try
-        {
-            Properties prop = PropertyUtils.loadPropertyFile( new File( "NON_EXISTENT_FILE" ), true, true );
-        }
-        catch ( Exception ex )
-        {
-            failed = true;
-        }
-
-        assertTrue( failed );
-    }
 }

Added: maven/plugins/trunk/maven-resources-plugin/src/test/java/org/apache/maven/plugins/resources/PropertyUtilsExceptionTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-resources-plugin/src/test/java/org/apache/maven/plugins/resources/PropertyUtilsExceptionTest.java?rev=1729076&view=auto
==============================================================================
--- maven/plugins/trunk/maven-resources-plugin/src/test/java/org/apache/maven/plugins/resources/PropertyUtilsExceptionTest.java (added)
+++ maven/plugins/trunk/maven-resources-plugin/src/test/java/org/apache/maven/plugins/resources/PropertyUtilsExceptionTest.java Mon Feb  8 06:23:30 2016
@@ -0,0 +1,42 @@
+package org.apache.maven.plugins.resources;
+
+/*
+ * 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 java.io.File;
+import java.io.FileNotFoundException;
+
+import org.apache.maven.shared.filtering.PropertyUtils;
+import org.junit.Test;
+
+public class PropertyUtilsExceptionTest
+{
+
+    /**
+     * load property test case can be adjusted by modifying the basic.properties and basic_validation properties
+     *
+     * @throws Exception
+     */
+    @Test( expected = FileNotFoundException.class )
+    public void loadPropertyFileShouldFailWithFileNotFoundException()
+        throws Exception
+    {
+        PropertyUtils.loadPropertyFile( new File( "NON_EXISTENT_FILE" ), true, true );
+    }
+}