+/*
+ * 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 <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.datamodel;
+
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertFalse;
import static org.testng.AssertJUnit.assertTrue;
-import jalview.datamodel.SearchResults.Match;
+import jalview.gui.JvOptionPane;
+import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
public class MatchTest
{
- @Test(groups = { "Functional" })
- public void testToString()
+ @BeforeClass(alwaysRun = true)
+ public void setUpJvOptionPane()
{
- SequenceI seq = new Sequence("", "abcdefghijklm");
- Match m = new SearchResults().new Match(seq, 3, 5);
- assertEquals("2cde", m.toString());
+ JvOptionPane.setInteractiveMode(false);
+ JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
}
@Test(groups = { "Functional" })
- public void testGetCharacters()
+ public void testToString()
{
- SequenceI seq = new Sequence("", "abcdefghijklm");
- Match m = new SearchResults().new Match(seq, 3, 5);
- assertEquals("cde", m.getCharacters());
+ SequenceI seq = new Sequence("Seq1", "abcdefghijklm");
+ SearchResultMatchI m = new SearchResults().new Match(seq, 3, 5);
+ assertEquals("Seq1/3-5", m.toString());
}
@Test(groups = { "Functional" })
{
SequenceI seq1 = new Sequence("", "abcdefghijklm");
SequenceI seq2 = new Sequence("", "abcdefghijklm");
- SearchResults sr1 = new SearchResults();
- SearchResults sr2 = new SearchResults();
+ SearchResultsI sr1 = new SearchResults();
+ SearchResultsI sr2 = new SearchResults();
assertFalse(sr1.equals(null));
assertFalse(sr1.equals(seq1));
/*
* same match but on different sequences - not equal
*/
- SearchResults sr3 = new SearchResults();
+ SearchResultsI sr3 = new SearchResults();
sr3.addResult(seq2, 1, 1);
assertFalse(sr1.equals(sr3));
assertFalse(sr3.equals(sr1));