package jalview.io;
-import jalview.json.binding.v1.BioJSReleasePojo;
-import jalview.json.binding.v1.BioJSRepositoryPojo;
-
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URLConnection;
import java.util.TreeMap;
-import org.junit.Assert;
-import org.junit.Test;
+import org.testng.Assert;
+import org.testng.AssertJUnit;
+import org.testng.annotations.Test;
+
+import jalview.json.binding.v1.BioJSReleasePojo;
+import jalview.json.binding.v1.BioJSRepositoryPojo;
public class BioJsHTMLOutputTest
@Test
public void getJalviewAlignmentAsJsonString()
{
- BioJsHTMLOutput bioJsHtmlOutput = new BioJsHTMLOutput(null, null);
String bjsTemplate = null;
try
{
- bioJsHtmlOutput.updateBioJS();
+ BioJsHTMLOutput.updateBioJS();
try
{
// allow the update some three seconds to complete before getting latest
Assert.assertNotNull(bjsTemplate);
}
- @Test(expected = NullPointerException.class)
+ @Test(expectedExceptions = NullPointerException.class)
public void expectedNullPointerException()
{
- BioJsHTMLOutput bjs = new BioJsHTMLOutput(null, null);
try
{
- bjs.refreshBioJSVersionsInfo(null);
+ BioJsHTMLOutput.refreshBioJSVersionsInfo(null);
} catch (URISyntaxException e)
{
- Assert.fail("Expception occured while testing!");
+ AssertJUnit.fail("Expception occured while testing!");
e.printStackTrace();
}
}
@Test
public void getBioJsMSAVersions()
{
- BioJsHTMLOutput bjs = new BioJsHTMLOutput(null, null);
TreeMap<String, File> versions = null;
try
{
- bjs.refreshBioJSVersionsInfo(BioJsHTMLOutput.BJS_TEMPLATES_LOCAL_DIRECTORY);
+ BioJsHTMLOutput
+ .refreshBioJSVersionsInfo(BioJsHTMLOutput.BJS_TEMPLATES_LOCAL_DIRECTORY);
versions = BioJsHTMLOutput.getBioJsMSAVersions();
} catch (URISyntaxException e)
{
- Assert.fail("Expception occured while testing!");
+ AssertJUnit.fail("Expception occured while testing!");
e.printStackTrace();
}
- Assert.assertNotNull("No versions found", versions);
- Assert.assertTrue("One or more Templates required", versions.size() > 0);
+ AssertJUnit.assertNotNull("No versions found", versions);
+ AssertJUnit.assertTrue("One or more Templates required", versions.size() > 0);
System.out
.println("Number of discovered versions : "
+ versions.size());
System.out.println("\nCurrent latest version : "
+ BioJsHTMLOutput.getCurrentBJSTemplateFile());
- Assert.assertNotNull("Latest BioJsMSA version NOT found!",
+ AssertJUnit.assertNotNull("Latest BioJsMSA version NOT found!",
BioJsHTMLOutput.getCurrentBJSTemplateFile());
}
public void testBioJsUpdate()
{
String url = BioJsHTMLOutput.BJS_TEMPLATE_GIT_REPO;
- Assert.assertTrue("URL not reacable : " + url, urlIsReachable(url));
+ AssertJUnit.assertTrue("URL not reacable : " + url, urlIsReachable(url));
String response = BioJsHTMLOutput.getURLContentAsString(url);
- Assert.assertNotNull("Null response read from url!", response);
+ AssertJUnit.assertNotNull("Null response read from url!", response);
BioJSRepositoryPojo repository = new BioJSRepositoryPojo(response);
System.out.println(">>> description : " + repository.getDescription());
System.out