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 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;
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 com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;
public class PDBRestClientTest
{
- @Before
+ @BeforeMethod
public void setUp() throws Exception
{
}
- @After
+ @AfterMethod
public void tearDown() throws Exception
{
}
} catch (Exception e)
{
e.printStackTrace();
- fail("Couldn't execute webservice call!");
+ Assert.fail("Couldn't execute webservice call!");
return;
}
assertTrue(response.getNumberOfItemsFound() > 99);
assertEquals(expectedErrorMsg, parsedErrorResponse);
}
- @Test(expected = Exception.class)
+ @Test(expectedExceptions = Exception.class)
public void testForExpectedRuntimeException() throws Exception
{
List<PDBDocField> wantedFields = new ArrayList<PDBDocField>();
// Check the response status and report exception if one occurs
if (clientResponse.getStatus() != 200)
{
- fail("Webservice call failed!!!");
+ Assert.fail("Webservice call failed!!!");
}
else
{
}
} 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();
}
}