file format enum wip changes
[jalview.git] / test / jalview / io / JSONFileTest.java
index 4371ff9..cd40bab 100644 (file)
@@ -35,7 +35,6 @@ import jalview.datamodel.SequenceI;
 import jalview.gui.AlignFrame;
 import jalview.json.binding.biojson.v1.ColourSchemeMapper;
 import jalview.schemes.ColourSchemeI;
-import jalview.schemes.ZappoColourScheme;
 
 import java.io.IOException;
 import java.util.ArrayList;
@@ -228,23 +227,26 @@ public class JSONFileTest
     try
     {
       alignment = (Alignment) formatAdapter.readFile(TEST_JSON_FILE,
-              AppletFormatAdapter.FILE, JSONFile.FILE_DESC);
+              DataSourceType.FILE, FileFormat.Json);
       jf = (JSONFile) formatAdapter.getAlignFile();
 
       AlignFrame af = new AlignFrame(alignment, jf.getHiddenSequences(),
               jf.getColumnSelection(), AlignFrame.DEFAULT_WIDTH,
               AlignFrame.DEFAULT_HEIGHT);
       af.getViewport().setShowSequenceFeatures(jf.isShowSeqFeatures());
-      af.changeColour(jf.getColourScheme());
+      String colourSchemeName = jf.getGlobalColourScheme();
+      ColourSchemeI cs = ColourSchemeMapper.getJalviewColourScheme(
+              colourSchemeName, alignment);
+      af.changeColour(cs);
       af.getViewport().setFeaturesDisplayed(jf.getDisplayedFeatures());
 
       formatAdapter = new AppletFormatAdapter(af.alignPanel, exportSettings);
-      String jsonOutput = formatAdapter.formatSequences(JSONFile.FILE_DESC,
+      String jsonOutput = formatAdapter.formatSequences(FileFormat.Json,
               af.alignPanel.getAlignment(), false);
 
       formatAdapter = new AppletFormatAdapter();
       testAlignment = formatAdapter.readFile(jsonOutput,
-              AppletFormatAdapter.PASTE, JSONFile.FILE_DESC);
+              DataSourceType.PASTE, FileFormat.Json);
       testJsonFile = (JSONFile) formatAdapter.getAlignFile();
       // System.out.println(jsonOutput);
     } catch (IOException e)
@@ -260,7 +262,7 @@ public class JSONFileTest
     passedCount = 0;
   }
 
-  @AfterTest
+  @AfterTest(alwaysRun = true)
   public void tearDown() throws Exception
   {
     testJsonFile = null;
@@ -318,10 +320,9 @@ public class JSONFileTest
   @Test(groups = { "Functional" })
   public void colorSchemeTest()
   {
-    Assert.assertNotNull(testJsonFile.getColourScheme(),
+    Assert.assertNotNull(testJsonFile.getGlobalColourScheme(),
             "Colourscheme is null, parsing failed!");
-    Assert.assertTrue(
-            testJsonFile.getColourScheme() instanceof ZappoColourScheme,
+    Assert.assertEquals(testJsonFile.getGlobalColourScheme(), "Zappo",
             "Zappo colour scheme expected!");
   }