maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rfscho...@apache.org
Subject svn commit: r1575033 - /maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/
Date Thu, 06 Mar 2014 20:36:24 GMT
Author: rfscholte
Date: Thu Mar  6 20:36:23 2014
New Revision: 1575033

URL: http://svn.apache.org/r1575033
Log:
Extra unittests

Modified:
    maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/AbstractInterpolatorFilterReaderLineEndingTest.java
    maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/InterpolatorFilterReaderLineEndingTest.java
    maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/MultiDelimiterInterpolatorFilterReaderLineEndingTest.java

Modified: maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/AbstractInterpolatorFilterReaderLineEndingTest.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/AbstractInterpolatorFilterReaderLineEndingTest.java?rev=1575033&r1=1575032&r2=1575033&view=diff
==============================================================================
--- maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/AbstractInterpolatorFilterReaderLineEndingTest.java
(original)
+++ maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/AbstractInterpolatorFilterReaderLineEndingTest.java
Thu Mar  6 20:36:23 2014
@@ -46,6 +46,41 @@ public abstract class AbstractInterpolat
     {
         MockitoAnnotations.initMocks( this );
     }
+    
+    @Test
+    public void testDefaults() throws Exception
+    {
+        when( interpolator.interpolate( eq( "${a}" ), eq( "" ), isA( RecursionInterceptor.class
) ) ).thenReturn( "DONE_A" );
+
+        Reader in = new StringReader( "text without expression" );
+        Reader reader = getDollarBracesReader( in, interpolator, "\\" );
+        assertEquals( "text without expression", IOUtil.toString( reader ) );
+
+        in = new StringReader( "valid expression ${a}" );
+        reader = getDollarBracesReader( in, interpolator, null );
+        assertEquals( "valid expression DONE_A", IOUtil.toString( reader ) );
+
+        in = new StringReader( "empty expression ${}" );
+        reader = getDollarBracesReader( in, interpolator, null );
+        assertEquals( "empty expression ${}", IOUtil.toString( reader ) );
+
+        in = new StringReader( "dollar space expression $ {a}" );
+        reader = getDollarBracesReader( in, interpolator, "\\" );
+        assertEquals( "dollar space expression $ {a}", IOUtil.toString( reader ) );
+
+        in = new StringReader( "space in expression ${ a}" );
+        reader = getDollarBracesReader( in, interpolator, "\\" );
+        assertEquals( "space in expression ${ a}", IOUtil.toString( reader ) );
+
+        in = new StringReader( "escape dollar with expression \\${a}" );
+        reader = getDollarBracesReader( in, interpolator, "\\" );
+        assertEquals( "escape dollar with expression ${a}", IOUtil.toString( reader ) );
+
+        in = new StringReader( "unknown expression ${unknown}" );
+        reader = getDollarBracesReader( in, interpolator, "\\" );
+        assertEquals( "unknown expression ${unknown}", IOUtil.toString( reader ) );
+    }
+    
 
     // MSHARED-198: custom delimiters doesn't work as expected
     @Test
@@ -68,5 +103,7 @@ public abstract class AbstractInterpolat
     protected abstract Reader getAbc_AbcReader( Reader in, Interpolator interpolator );
     
     protected abstract Reader getAaa_AaaReader( Reader in, Interpolator interpolator );
+    
+    protected abstract Reader getDollarBracesReader( Reader in, Interpolator interpolator,
String escapeString );
 
 }
\ No newline at end of file

Modified: maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/InterpolatorFilterReaderLineEndingTest.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/InterpolatorFilterReaderLineEndingTest.java?rev=1575033&r1=1575032&r2=1575033&view=diff
==============================================================================
--- maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/InterpolatorFilterReaderLineEndingTest.java
(original)
+++ maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/InterpolatorFilterReaderLineEndingTest.java
Thu Mar  6 20:36:23 2014
@@ -37,4 +37,12 @@ public class InterpolatorFilterReaderLin
     {
         return new InterpolatorFilterReaderLineEnding( in, interpolator, "abc", "abc", true
);
     }
+    
+    @Override
+    protected Reader getDollarBracesReader( Reader in, Interpolator interpolator, String
escapeString )
+    {
+        InterpolatorFilterReaderLineEnding reader = new InterpolatorFilterReaderLineEnding(
in, interpolator, "${", "}", true );
+        reader.setEscapeString( escapeString );
+        return reader;
+    }
 }

Modified: maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/MultiDelimiterInterpolatorFilterReaderLineEndingTest.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/MultiDelimiterInterpolatorFilterReaderLineEndingTest.java?rev=1575033&r1=1575032&r2=1575033&view=diff
==============================================================================
--- maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/MultiDelimiterInterpolatorFilterReaderLineEndingTest.java
(original)
+++ maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/MultiDelimiterInterpolatorFilterReaderLineEndingTest.java
Thu Mar  6 20:36:23 2014
@@ -65,6 +65,15 @@ public class MultiDelimiterInterpolatorF
         reader.setDelimiterSpecs( Collections.singleton( "abc*abc" ) );
         return reader;
     }
+    
+    @Override
+    protected Reader getDollarBracesReader( Reader in, Interpolator interpolator, String
escapeString )
+    {
+        MultiDelimiterInterpolatorFilterReaderLineEnding reader = new MultiDelimiterInterpolatorFilterReaderLineEnding(
in, interpolator, true );
+        reader.setDelimiterSpecs( Collections.singleton( "${*}" ) );
+        reader.setEscapeString( escapeString );
+        return reader;
+    }
 
     // MSHARED-199: Filtering doesn't work if 2 delimiters are used on the same line, the
first one being left open
     @Test



Mime
View raw message