X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fmc_view%2FResidueTest.java;fp=test%2Fmc_view%2FResidueTest.java;h=c676cd3476e3c4799df21b316fefaaea6c5f9faf;hb=59d2feb135a7da8e92b68491f177159913c60244;hp=0000000000000000000000000000000000000000;hpb=8ca1ac83b31ae44e8025b246800a4671f44cbb0c;p=jalview.git diff --git a/test/mc_view/ResidueTest.java b/test/mc_view/ResidueTest.java new file mode 100644 index 0000000..c676cd3 --- /dev/null +++ b/test/mc_view/ResidueTest.java @@ -0,0 +1,66 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ +package mc_view; + +import static org.testng.AssertJUnit.assertNull; +import static org.testng.AssertJUnit.assertSame; + +import jalview.gui.JvOptionPane; + +import java.util.Vector; + +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +public class ResidueTest +{ + + @BeforeClass(alwaysRun = true) + public void setUpJvOptionPane() + { + JvOptionPane.setInteractiveMode(false); + JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); + } + + @Test(groups = { "Functional" }) + public void testFindAtom() + { + Atom a1 = new Atom(1f, 2f, 3f); + a1.name = "C"; + Atom a2 = new Atom(1f, 2f, 3f); + a2.name = "A"; + Atom a3 = new Atom(1f, 2f, 3f); + a3.name = "P"; + Atom a4 = new Atom(1f, 2f, 3f); + a4.name = "C"; + Vector v = new Vector(); + v.add(a1); + v.add(a2); + v.add(a3); + v.add(a4); + Residue r = new Residue(v, 293, 12); + + assertSame(a1, r.findAtom("C")); + assertSame(a2, r.findAtom("A")); + assertSame(a3, r.findAtom("P")); + assertNull(r.findAtom("S")); + } +}