+ assertSame(al.getSequenceAt(2), match.getSequence());
+ assertEquals(4, match.getStart());
+ assertEquals(4, match.getEnd());
+
+ /*
+ * search for 'Q' should match two sequence ids only
+ */
+ f = new Finder(al, sg);
+ f.setFindAll(true);
+ f.find("Q");
+ assertEquals(f.getIdMatch().size(), 2);
+ assertSame(f.getIdMatch().get(0), al.getSequenceAt(1));
+ assertSame(f.getIdMatch().get(1), al.getSequenceAt(2));
+ assertTrue(f.getSearchResults().isEmpty());
+ }
+
+ /**
+ * Test finding in selection with a sequence too short to reach it
+ */
+ @Test(groups = "Functional")
+ public void testFind_findAllInSelectionWithShortSequence()
+ {
+ /*
+ * select all sequences, columns 10-12
+ * BCD
+ * cdE
+ */
+ SequenceGroup sg = new SequenceGroup();
+ sg.setStartRes(9);
+ sg.setEndRes(11);
+ sg.addSequence(al.getSequenceAt(0), false);
+ sg.addSequence(al.getSequenceAt(1), false);
+ sg.addSequence(al.getSequenceAt(2), false);
+ sg.addSequence(al.getSequenceAt(3), false);
+
+ /*
+ * search for 'I' should match two sequence positions
+ */
+ Finder f = new Finder(al, sg);
+ f.setFindAll(true);
+ f.find("I");
+ assertTrue(f.getIdMatch().isEmpty());
+ SearchResultsI searchResults = f.getSearchResults();
+ assertEquals(searchResults.getSize(), 2);
+ SearchResultMatchI match = searchResults.getResults().get(0);
+ assertSame(al.getSequenceAt(0), match.getSequence());
+ assertEquals(16, match.getStart());
+ assertEquals(16, match.getEnd());
+ match = searchResults.getResults().get(1);
+ assertSame(al.getSequenceAt(1), match.getSequence());
+ assertEquals(8, match.getStart());
+ assertEquals(8, match.getEnd());