package jalview.util;
import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
import static org.testng.AssertJUnit.assertNull;
import static org.testng.AssertJUnit.assertSame;
import static org.testng.AssertJUnit.assertTrue;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceI;
+import jalview.gui.JvOptionPane;
import java.util.List;
+import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
public class DBRefUtilsTest
{
+ @BeforeClass(alwaysRun = true)
+ public void setUpJvOptionPane()
+ {
+ JvOptionPane.setInteractiveMode(false);
+ JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
+ }
+
/**
* Test the method that selects DBRefEntry items whose source is in a supplied
* list
assertEquals("pfam", DBRefUtils.getCanonicalName("pfam"));
}
-
- @Test(groups = { "Functional" })
- public void testIsDasCoordinateSystem()
- {
- assertFalse(DBRefUtils.isDasCoordinateSystem(null, null));
- assertFalse(DBRefUtils.isDasCoordinateSystem("pdbresnum", null));
- assertFalse(DBRefUtils.isDasCoordinateSystem(null, new DBRefEntry(
- "PDB", "v1", "a1")));
-
- assertTrue(DBRefUtils.isDasCoordinateSystem("pdbresnum",
- new DBRefEntry("PDB", "v1", "a1")));
- assertTrue(DBRefUtils.isDasCoordinateSystem("PDBRESNUM",
- new DBRefEntry("PDB", "v1", "a1")));
- // "pdb" is converted to upper-case in DBRefEntry constructor
- assertTrue(DBRefUtils.isDasCoordinateSystem("pdbresnum",
- new DBRefEntry("pdb", "v1", "a1")));
- assertFalse(DBRefUtils.isDasCoordinateSystem("pdb", new DBRefEntry(
- "pdb", "v1", "a1")));
-
- assertTrue(DBRefUtils.isDasCoordinateSystem("UNIPROT", new DBRefEntry(
- "Uniprot", "v1", "a1")));
- assertTrue(DBRefUtils.isDasCoordinateSystem("Uniprot", new DBRefEntry(
- "UNIPROT", "v1", "a1")));
- assertFalse(DBRefUtils.isDasCoordinateSystem("UNIPROTKB",
- new DBRefEntry("pdb", "v1", "a1")));
-
- assertTrue(DBRefUtils.isDasCoordinateSystem("EMBL", new DBRefEntry(
- "EMBL", "v1", "a1")));
- assertTrue(DBRefUtils.isDasCoordinateSystem("embl", new DBRefEntry(
- "embl", "v1", "a1")));
- }
-
/**
* Test 'parsing' a DBRef - non PDB case
*/
assertEquals("1.2", ref.getVersion());
assertEquals("a7890", ref.getAccessionId());
assertTrue(seq.getAllPDBEntries().isEmpty());
+ SequenceI seq2 = new Sequence("Seq2", "ABCD");
+ // Check that whitespace doesn't confuse parseToDbRef
+ DBRefEntry ref2 = DBRefUtils.parseToDbRef(seq2, "EMBL", "1.2",
+ " a7890");
+ assertEquals(ref, ref2);
}
/**