knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From su...@apache.org
Subject knox git commit: KNOX-690 quick unit test for toEncodedString method
Date Thu, 07 Apr 2016 17:33:06 GMT
Repository: knox
Updated Branches:
  refs/heads/v0.9.0 994836cb6 -> d435c1eba


KNOX-690 quick unit test for toEncodedString method


Project: http://git-wip-us.apache.org/repos/asf/knox/repo
Commit: http://git-wip-us.apache.org/repos/asf/knox/commit/d435c1eb
Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/d435c1eb
Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/d435c1eb

Branch: refs/heads/v0.9.0
Commit: d435c1eba6e2309b107d89f8bdc2cd17f18a60fd
Parents: 994836c
Author: Sumit Gupta <sumit@apache.org>
Authored: Thu Apr 7 13:07:29 2016 -0400
Committer: Sumit Gupta <sumit@apache.org>
Committed: Thu Apr 7 13:33:00 2016 -0400

----------------------------------------------------------------------
 .../gateway/util/urltemplate/TemplateTest.java      | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/d435c1eb/gateway-util-urltemplate/src/test/java/org/apache/hadoop/gateway/util/urltemplate/TemplateTest.java
----------------------------------------------------------------------
diff --git a/gateway-util-urltemplate/src/test/java/org/apache/hadoop/gateway/util/urltemplate/TemplateTest.java
b/gateway-util-urltemplate/src/test/java/org/apache/hadoop/gateway/util/urltemplate/TemplateTest.java
index c99421c..1b8a1db 100644
--- a/gateway-util-urltemplate/src/test/java/org/apache/hadoop/gateway/util/urltemplate/TemplateTest.java
+++ b/gateway-util-urltemplate/src/test/java/org/apache/hadoop/gateway/util/urltemplate/TemplateTest.java
@@ -23,11 +23,8 @@ import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 import java.net.URISyntaxException;
-import java.util.regex.Pattern;
 
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.nullValue;
+import static org.hamcrest.CoreMatchers.*;
 import static org.hamcrest.core.IsNot.not;
 import static org.junit.Assert.assertThat;
 
@@ -174,4 +171,15 @@ public class TemplateTest {
     assertThat( t1.equals( t3 ), equalTo( false ) );
   }
 
+  @Test
+  public void encodedToString() throws Exception {
+    String url = "scheme://username:password@host:port/top/mid/bot/file|?query|=value|#|fragment1";
+    Template t = Parser.parseLiteral(url);
+    assertThat( t.toString().equals( url ), equalTo(true));
+    assertThat( t.toEncodedString()
+        .equals( "scheme://username:password@host:port/top/mid/bot/file%7C?query%7C=value%7C#%7Cfragment1")
+        , equalTo(true));
+
+  }
+
 }


Mime
View raw message