JAL-1805 modified test setup's so the are ran for groups which requires them
[jalview.git] / test / jalview / ws / dbsources / PDBRestClientTest.java
index f92a32e..9ae5b26 100644 (file)
@@ -2,10 +2,7 @@ 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 +20,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 +34,7 @@ import com.sun.jersey.api.client.config.DefaultClientConfig;
 public class PDBRestClientTest
 {
 
-  @BeforeMethod
+ @BeforeMethod(alwaysRun = true)
   public void setUp() throws Exception
   {
   }
@@ -42,7 +44,8 @@ public class PDBRestClientTest
   {
   }
 
-  @Test
+  @Test(groups =
+  { "External", "Network" })
   public void executeRequestTest()
   {
     List<PDBDocField> wantedFields = new ArrayList<PDBDocField>();
@@ -74,7 +77,7 @@ public class PDBRestClientTest
     assertTrue(response.getSearchSummary().size() > 99);
   }
 
-  @Test
+  @Test(groups ={ "Functional" })
   public void getPDBDocFieldsAsCommaDelimitedStringTest()
   {
     List<PDBDocField> wantedFields = new ArrayList<PDBDocField>();
@@ -91,7 +94,8 @@ public class PDBRestClientTest
     assertEquals("", expectedResult, actualResult);
   }
 
-  @Test
+  @Test(groups =
+  { "External, Network" })
   public void parsePDBJsonExceptionStringTest()
   {
     List<PDBDocField> wantedFields = new ArrayList<PDBDocField>();
@@ -129,7 +133,8 @@ public class PDBRestClientTest
     assertEquals(expectedErrorMsg, parsedErrorResponse);
   }
 
-  @Test(expectedExceptions = Exception.class)
+  @Test(groups =
+  { "External", "Network" }, expectedExceptions = Exception.class)
   public void testForExpectedRuntimeException() throws Exception
   {
     List<PDBDocField> wantedFields = new ArrayList<PDBDocField>();
@@ -142,7 +147,8 @@ public class PDBRestClientTest
     new PDBRestClient().executeRequest(request);
   }
 
-  @Test
+  @Test(groups =
+  { "External" })
   public void parsePDBJsonResponseTest()
   {
     List<PDBDocField> wantedFields = new ArrayList<PDBDocField>();
@@ -171,7 +177,7 @@ public class PDBRestClientTest
     assertTrue(response.getSearchSummary().size() == 14);
   }
 
-  @Test
+  @Test(groups ={ "Functional" })
   public void getPDBIdColumIndexTest()
   {
     List<PDBDocField> wantedFields = new ArrayList<PDBDocField>();
@@ -184,7 +190,8 @@ public class PDBRestClientTest
     assertEquals(4, PDBRestClient.getPDBIdColumIndex(wantedFields, false));
   }
 
-  @Test
+  @Test(groups =
+  { "External" })
   public void externalServiceIntegrationTest()
   {
     ClientConfig clientConfig = new DefaultClientConfig();