git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
JAL-1805 test envirionment separation
[jalview.git]
/
test
/
jalview
/
ws
/
dbsources
/
PDBRestClientTest.java
diff --git
a/test/jalview/ws/dbsources/PDBRestClientTest.java
b/test/jalview/ws/dbsources/PDBRestClientTest.java
index
86cb3a3
..
00c1e02
100644
(file)
--- a/
test/jalview/ws/dbsources/PDBRestClientTest.java
+++ b/
test/jalview/ws/dbsources/PDBRestClientTest.java
@@
-1,8
+1,8
@@
package jalview.ws.dbsources;
package jalview.ws.dbsources;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
+
import jalview.ws.dbsources.PDBRestClient.PDBDocField;
import jalview.ws.uimodel.PDBRestRequest;
import jalview.ws.uimodel.PDBRestResponse;
import jalview.ws.dbsources.PDBRestClient.PDBDocField;
import jalview.ws.uimodel.PDBRestRequest;
import jalview.ws.uimodel.PDBRestResponse;
@@
-20,9
+20,10
@@
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+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.Client;
import com.sun.jersey.api.client.ClientResponse;
@@
-33,17
+34,18
@@
import com.sun.jersey.api.client.config.DefaultClientConfig;
public class PDBRestClientTest
{
public class PDBRestClientTest
{
- @Before
+ @BeforeMethod
public void setUp() throws Exception
{
}
public void setUp() throws Exception
{
}
- @After
+ @AfterMethod
public void tearDown() throws Exception
{
}
public void tearDown() throws Exception
{
}
- @Test
+ @Test(groups =
+ { "External" })
public void executeRequestTest()
{
List<PDBDocField> wantedFields = new ArrayList<PDBDocField>();
public void executeRequestTest()
{
List<PDBDocField> wantedFields = new ArrayList<PDBDocField>();
@@
-60,13
+62,22
@@
public class PDBRestClientTest
request.setSearchTerm("abc");
request.setWantedFields(wantedFields);
request.setSearchTerm("abc");
request.setWantedFields(wantedFields);
- PDBRestResponse response = new PDBRestClient().executeRequest(request);
+ PDBRestResponse response;
+ try
+ {
+ response = new PDBRestClient().executeRequest(request);
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ Assert.fail("Couldn't execute webservice call!");
+ return;
+ }
assertTrue(response.getNumberOfItemsFound() > 99);
assertTrue(response.getSearchSummary() != null);
assertTrue(response.getSearchSummary().size() > 99);
}
assertTrue(response.getNumberOfItemsFound() > 99);
assertTrue(response.getSearchSummary() != null);
assertTrue(response.getSearchSummary().size() > 99);
}
- @Test
+ @Test(groups ={ "Functional" })
public void getPDBDocFieldsAsCommaDelimitedStringTest()
{
List<PDBDocField> wantedFields = new ArrayList<PDBDocField>();
public void getPDBDocFieldsAsCommaDelimitedStringTest()
{
List<PDBDocField> wantedFields = new ArrayList<PDBDocField>();
@@
-83,7
+94,8
@@
public class PDBRestClientTest
assertEquals("", expectedResult, actualResult);
}
assertEquals("", expectedResult, actualResult);
}
- @Test
+ @Test(groups =
+ { "External" })
public void parsePDBJsonExceptionStringTest()
{
List<PDBDocField> wantedFields = new ArrayList<PDBDocField>();
public void parsePDBJsonExceptionStringTest()
{
List<PDBDocField> wantedFields = new ArrayList<PDBDocField>();
@@
-121,8
+133,9
@@
public class PDBRestClientTest
assertEquals(expectedErrorMsg, parsedErrorResponse);
}
assertEquals(expectedErrorMsg, parsedErrorResponse);
}
- @Test(expected = RuntimeException.class)
- public void testForExpectedRuntimeException()
+ @Test(groups =
+ { "External" }, expectedExceptions = Exception.class)
+ public void testForExpectedRuntimeException() throws Exception
{
List<PDBDocField> wantedFields = new ArrayList<PDBDocField>();
wantedFields.add(PDBDocField.PDB_ID);
{
List<PDBDocField> wantedFields = new ArrayList<PDBDocField>();
wantedFields.add(PDBDocField.PDB_ID);
@@
-134,7
+147,8
@@
public class PDBRestClientTest
new PDBRestClient().executeRequest(request);
}
new PDBRestClient().executeRequest(request);
}
- @Test
+ @Test(groups =
+ { "External" })
public void parsePDBJsonResponseTest()
{
List<PDBDocField> wantedFields = new ArrayList<PDBDocField>();
public void parsePDBJsonResponseTest()
{
List<PDBDocField> wantedFields = new ArrayList<PDBDocField>();
@@
-163,7
+177,7
@@
public class PDBRestClientTest
assertTrue(response.getSearchSummary().size() == 14);
}
assertTrue(response.getSearchSummary().size() == 14);
}
- @Test
+ @Test(groups ={ "Functional" })
public void getPDBIdColumIndexTest()
{
List<PDBDocField> wantedFields = new ArrayList<PDBDocField>();
public void getPDBIdColumIndexTest()
{
List<PDBDocField> wantedFields = new ArrayList<PDBDocField>();
@@
-176,7
+190,8
@@
public class PDBRestClientTest
assertEquals(4, PDBRestClient.getPDBIdColumIndex(wantedFields, false));
}
assertEquals(4, PDBRestClient.getPDBIdColumIndex(wantedFields, false));
}
- @Test
+ @Test(groups =
+ { "External" })
public void externalServiceIntegrationTest()
{
ClientConfig clientConfig = new DefaultClientConfig();
public void externalServiceIntegrationTest()
{
ClientConfig clientConfig = new DefaultClientConfig();
@@
-198,7
+213,7
@@
public class PDBRestClientTest
// Check the response status and report exception if one occurs
if (clientResponse.getStatus() != 200)
{
// Check the response status and report exception if one occurs
if (clientResponse.getStatus() != 200)
{
- fail("Webservice call failed!!!");
+ Assert.fail("Webservice call failed!!!");
}
else
{
}
else
{
@@
-239,7
+254,7
@@
public class PDBRestClientTest
}
} catch (ParseException e)
{
}
} catch (ParseException e)
{
- fail(">>> Test failed due to exception while parsing pdb response json !!!");
+ Assert.fail(">>> Test failed due to exception while parsing pdb response json !!!");
e.printStackTrace();
}
}
e.printStackTrace();
}
}