more unit tests
authorEugene Petrenko <eugene.petrenko@gmail.com>
Fri, 12 Aug 2011 11:25:33 +0000 (15:25 +0400)
committerEugene Petrenko <eugene.petrenko@gmail.com>
Fri, 12 Aug 2011 11:25:33 +0000 (15:25 +0400)
nuget-tests/nuget-tests.iml
nuget-tests/src/jetbrains/buildServer/nuget/tests/server/feed/reader/FeedGetMethodFactoryTest.java [new file with mode: 0644]
nuget-tests/src/testng-nuget-fast.xml

index 88001f85eb1e41599d07355af3c7d112a5984db0..cb909629b8052fa06878e0dfca0ce5a8149e243a 100644 (file)
@@ -22,6 +22,7 @@
     <orderEntry type="library" scope="RUNTIME" name="TeamCity agent runtime" level="project" />\r
     <orderEntry type="library" name="Common-Impl" level="project" />\r
     <orderEntry type="library" name="Server-Api" level="project" />\r
+    <orderEntry type="library" name="commons-http" level="project" />\r
   </component>\r
 </module>\r
 \r
diff --git a/nuget-tests/src/jetbrains/buildServer/nuget/tests/server/feed/reader/FeedGetMethodFactoryTest.java b/nuget-tests/src/jetbrains/buildServer/nuget/tests/server/feed/reader/FeedGetMethodFactoryTest.java
new file mode 100644 (file)
index 0000000..c424fa4
--- /dev/null
@@ -0,0 +1,77 @@
+/*\r
+ * Copyright 2000-2011 JetBrains s.r.o.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+package jetbrains.buildServer.nuget.tests.server.feed.reader;\r
+\r
+import jetbrains.buildServer.BaseTestCase;\r
+import jetbrains.buildServer.nuget.server.feed.reader.impl.FeedGetMethodFactory;\r
+import jetbrains.buildServer.nuget.server.feed.reader.impl.Param;\r
+import org.apache.http.client.methods.HttpGet;\r
+import org.testng.Assert;\r
+import org.testng.annotations.BeforeMethod;\r
+import org.testng.annotations.Test;\r
+\r
+/**\r
+ * Created by Eugene Petrenko (eugene.petrenko@gmail.com)\r
+ * Date: 12.08.11 15:19\r
+ */\r
+public class FeedGetMethodFactoryTest extends BaseTestCase {\r
+  private FeedGetMethodFactory myFactory;\r
+\r
+\r
+  @BeforeMethod\r
+  @Override\r
+  protected void setUp() throws Exception {\r
+    super.setUp();\r
+    myFactory = new FeedGetMethodFactory();\r
+  }\r
+\r
+  @Test\r
+  public void test_emptyParams() {\r
+    final HttpGet get = myFactory.createGet("http://jetbrais.com");\r
+    Assert.assertEquals(get.getURI().toString(), "http://jetbrais.com");\r
+  }\r
+\r
+  @Test\r
+  public void test_withParams() {\r
+    final HttpGet get = myFactory.createGet("http://jetbrais.com?aaa=bbb");\r
+    Assert.assertEquals(get.getURI().toString(), "http://jetbrais.com?aaa=bbb");\r
+  }\r
+\r
+  @Test\r
+  public void test_withParams2() {\r
+    final HttpGet get = myFactory.createGet("http://jetbrais.com?aaa=bbb", new Param("qqq","ppp"));\r
+    Assert.assertEquals(get.getURI().toString(), "http://jetbrais.com?aaa=bbb&qqq=ppp");\r
+  }\r
+\r
+  @Test\r
+  public void test_withParams3() {\r
+    final HttpGet get = myFactory.createGet("http://jetbrais.com?aaa=bbb", new Param("qqq","ppp"), new Param("www","ttt"));\r
+    Assert.assertEquals(get.getURI().toString(), "http://jetbrais.com?aaa=bbb&qqq=ppp&www=ttt");\r
+  }\r
+\r
+  @Test\r
+  public void test_withParams4() {\r
+    final HttpGet get = myFactory.createGet("http://jetbrais.com", new Param("qqq","ppp"), new Param("www","ttt"));\r
+    Assert.assertEquals(get.getURI().toString(), "http://jetbrais.com?qqq=ppp&www=ttt");\r
+  }\r
+\r
+  @Test\r
+  public void test_withParams5() {\r
+    final HttpGet get = myFactory.createGet("http://jetbrais.com", new Param("$qqq","ppp"), new Param("$www","t t 't'"));\r
+    Assert.assertEquals(get.getURI().toString(), "http://jetbrais.com?%24qqq=ppp&%24www=t+t+%27t%27");\r
+  }\r
+}\r
index 95877b5ba340eb29d3044e0025c153b5e643632f..1a0b53fd539a8f25d80e71a9cbc4b6182f0d5eb9 100644 (file)
@@ -27,6 +27,7 @@
       <class name="jetbrains.buildServer.nuget.tests.agent.MatchFilesBuildProcessTest"/>\r
 \r
       <class name="jetbrains.buildServer.nuget.tests.server.feed.reader.FeedPackagesParserTest"/>\r
+      <class name="jetbrains.buildServer.nuget.tests.server.feed.reader.FeedGetMethodFactoryTest"/>\r
     </classes>\r
   </test>\r
 </suite>\r