package jalview.gui; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNull; import jalview.datamodel.PDBEntry; import jalview.datamodel.PDBEntry.Type; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; public class StructureViewerTest { @BeforeClass(alwaysRun = true) public void setUpJvOptionPane() { JvOptionPane.setInteractiveMode(false); JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); } @Test(groups = "Functional") public void testGetUniquePdbFiles() { assertNull(StructureViewer.getUniquePdbFiles(null)); PDBEntry pdbe1 = new PDBEntry("1A70", "A", Type.PDB, "path1"); PDBEntry pdbe2 = new PDBEntry("3A6S", "A", Type.PDB, "path2"); PDBEntry pdbe3 = new PDBEntry("1A70", "B", Type.PDB, "path1"); PDBEntry pdbe4 = new PDBEntry("1GAQ", "A", Type.PDB, null); PDBEntry pdbe5 = new PDBEntry("3A6S", "B", Type.PDB, "path2"); PDBEntry pdbe6 = new PDBEntry("1GAQ", "B", Type.PDB, null); /* * pdbe2 and pdbe5 get removed as having a duplicate file path */ PDBEntry[] uniques = StructureViewer.getUniquePdbFiles(new PDBEntry[] { pdbe1, pdbe2, pdbe3, pdbe4, pdbe5, pdbe6 }); assertEquals(uniques, new PDBEntry[] { pdbe1, pdbe2, pdbe4, pdbe6 }); } }