X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fws%2Fdbsources%2FPDBRestClientTest.java;h=f3cd9ef138018002d1b326d51cf25cc72ad55922;hb=c19d2a91ca05e052e3408bf5852d88eb5d0608f1;hp=f92a32ef90bba273279a43f3b339b54fdbf2ce97;hpb=3412b273e964fb1a9d22564b04a5f0c827ec2461;p=jalview.git
diff --git a/test/jalview/ws/dbsources/PDBRestClientTest.java b/test/jalview/ws/dbsources/PDBRestClientTest.java
index f92a32e..f3cd9ef 100644
--- a/test/jalview/ws/dbsources/PDBRestClientTest.java
+++ b/test/jalview/ws/dbsources/PDBRestClientTest.java
@@ -1,11 +1,28 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9.0b2)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see .
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.ws.dbsources;
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertTrue;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.Test;
-import org.testng.annotations.BeforeMethod;
-import org.testng.Assert;
+
import jalview.ws.dbsources.PDBRestClient.PDBDocField;
import jalview.ws.uimodel.PDBRestRequest;
import jalview.ws.uimodel.PDBRestResponse;
@@ -23,6 +40,11 @@ import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
+import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;
@@ -32,7 +54,7 @@ import com.sun.jersey.api.client.config.DefaultClientConfig;
public class PDBRestClientTest
{
- @BeforeMethod
+ @BeforeMethod(alwaysRun = true)
public void setUp() throws Exception
{
}
@@ -42,7 +64,7 @@ public class PDBRestClientTest
{
}
- @Test
+ @Test(groups = { "External", "Network" })
public void executeRequestTest()
{
List wantedFields = new ArrayList();
@@ -74,7 +96,7 @@ public class PDBRestClientTest
assertTrue(response.getSearchSummary().size() > 99);
}
- @Test
+ @Test(groups = { "Functional" })
public void getPDBDocFieldsAsCommaDelimitedStringTest()
{
List wantedFields = new ArrayList();
@@ -91,7 +113,7 @@ public class PDBRestClientTest
assertEquals("", expectedResult, actualResult);
}
- @Test
+ @Test(groups = { "External, Network" })
public void parsePDBJsonExceptionStringTest()
{
List wantedFields = new ArrayList();
@@ -129,7 +151,9 @@ public class PDBRestClientTest
assertEquals(expectedErrorMsg, parsedErrorResponse);
}
- @Test(expectedExceptions = Exception.class)
+ @Test(
+ groups = { "External", "Network" },
+ expectedExceptions = Exception.class)
public void testForExpectedRuntimeException() throws Exception
{
List wantedFields = new ArrayList();
@@ -142,7 +166,7 @@ public class PDBRestClientTest
new PDBRestClient().executeRequest(request);
}
- @Test
+ @Test(groups = { "External" })
public void parsePDBJsonResponseTest()
{
List wantedFields = new ArrayList();
@@ -171,7 +195,7 @@ public class PDBRestClientTest
assertTrue(response.getSearchSummary().size() == 14);
}
- @Test
+ @Test(groups = { "Functional" })
public void getPDBIdColumIndexTest()
{
List wantedFields = new ArrayList();
@@ -184,7 +208,7 @@ public class PDBRestClientTest
assertEquals(4, PDBRestClient.getPDBIdColumIndex(wantedFields, false));
}
- @Test
+ @Test(groups = { "External" })
public void externalServiceIntegrationTest()
{
ClientConfig clientConfig = new DefaultClientConfig();
@@ -240,7 +264,7 @@ public class PDBRestClientTest
if (pdbJsonDoc.get(field.getCode()) == null)
{
// System.out.println(">>>\t" + field.getCode());
- assertTrue(field.getClass()
+ assertTrue(field.getCode()
+ " has been removed from PDB doc Entity",
!pdbJsonResponseString.contains(field.getCode()));
}
@@ -267,7 +291,7 @@ public class PDBRestClientTest
sb.append(line);
sb.append(System.lineSeparator());
line = br.readLine();
- }
+ }
fileContent = sb.toString();
} finally
{