Search in sources :

Example 1 with ComponentFinder

use of org.assertj.swing.core.ComponentFinder in project jabref by JabRef.

the class SearchResultsTest method testSearchFieldQuery.

@Test
public void testSearchFieldQuery() {
    frameFixture.menuItemWithPath("Search", "Search").click();
    JTextComponentFixture searchField = frameFixture.textBox();
    ComponentFinder finder = robot().finder();
    BasePanel panel = finder.findByType(BasePanel.class);
    Collection<BibEntry> entries = panel.getDatabase().getEntries();
    searchField.deleteText().enterText("");
    Assert.assertEquals(19, entries.size());
    searchField.deleteText().enterText("entrytype=article");
    Assert.assertFalse(entries.stream().noneMatch(entry -> entry.isSearchHit()));
    Assert.assertEquals(5, entries.stream().filter(entry -> entry.isSearchHit()).count());
    searchField.deleteText().enterText("entrytype=proceedings");
    Assert.assertFalse(entries.stream().noneMatch(entry -> entry.isSearchHit()));
    Assert.assertEquals(13, entries.stream().filter(entry -> entry.isSearchHit()).count());
    searchField.deleteText().enterText("entrytype=book");
    Assert.assertFalse(entries.stream().noneMatch(entry -> entry.isSearchHit()));
    Assert.assertEquals(1, entries.stream().filter(entry -> entry.isSearchHit()).count());
}
Also used : ComponentFinder(org.assertj.swing.core.ComponentFinder) FailOnThreadViolationRepaintManager(org.assertj.swing.edt.FailOnThreadViolationRepaintManager) BeforeClass(org.junit.BeforeClass) AssertJSwingJUnitTestCase(org.assertj.swing.junit.testcase.AssertJSwingJUnitTestCase) Collection(java.util.Collection) BibEntry(org.jabref.model.entry.BibEntry) WindowFinder(org.assertj.swing.finder.WindowFinder) Test(org.junit.Test) Category(org.junit.experimental.categories.Category) BasePanel(org.jabref.gui.BasePanel) TestUtils(org.jabref.testutils.TestUtils) GUITests(org.jabref.testutils.category.GUITests) TimeUnit(java.util.concurrent.TimeUnit) ComponentFinder(org.assertj.swing.core.ComponentFinder) JTextComponentFixture(org.assertj.swing.fixture.JTextComponentFixture) FrameFixture(org.assertj.swing.fixture.FrameFixture) JFrame(javax.swing.JFrame) Assert(org.junit.Assert) BibEntry(org.jabref.model.entry.BibEntry) BasePanel(org.jabref.gui.BasePanel) JTextComponentFixture(org.assertj.swing.fixture.JTextComponentFixture) Test(org.junit.Test)

Example 2 with ComponentFinder

use of org.assertj.swing.core.ComponentFinder in project jabref by JabRef.

the class SearchResultsTest method testSeachWithoutResults.

@Test
public void testSeachWithoutResults() {
    frameFixture.menuItemWithPath("Search", "Search").click();
    JTextComponentFixture searchField = frameFixture.textBox();
    ComponentFinder finder = robot().finder();
    BasePanel panel = finder.findByType(BasePanel.class);
    Collection<BibEntry> entries = panel.getDatabase().getEntries();
    searchField.deleteText().enterText("asdf");
    Assert.assertTrue(entries.stream().noneMatch(entry -> entry.isSearchHit()));
}
Also used : ComponentFinder(org.assertj.swing.core.ComponentFinder) FailOnThreadViolationRepaintManager(org.assertj.swing.edt.FailOnThreadViolationRepaintManager) BeforeClass(org.junit.BeforeClass) AssertJSwingJUnitTestCase(org.assertj.swing.junit.testcase.AssertJSwingJUnitTestCase) Collection(java.util.Collection) BibEntry(org.jabref.model.entry.BibEntry) WindowFinder(org.assertj.swing.finder.WindowFinder) Test(org.junit.Test) Category(org.junit.experimental.categories.Category) BasePanel(org.jabref.gui.BasePanel) TestUtils(org.jabref.testutils.TestUtils) GUITests(org.jabref.testutils.category.GUITests) TimeUnit(java.util.concurrent.TimeUnit) ComponentFinder(org.assertj.swing.core.ComponentFinder) JTextComponentFixture(org.assertj.swing.fixture.JTextComponentFixture) FrameFixture(org.assertj.swing.fixture.FrameFixture) JFrame(javax.swing.JFrame) Assert(org.junit.Assert) BibEntry(org.jabref.model.entry.BibEntry) BasePanel(org.jabref.gui.BasePanel) JTextComponentFixture(org.assertj.swing.fixture.JTextComponentFixture) Test(org.junit.Test)

Example 3 with ComponentFinder

use of org.assertj.swing.core.ComponentFinder in project jabref by JabRef.

the class SearchResultsTest method testSearchInvalidQuery.

@Test
public void testSearchInvalidQuery() {
    frameFixture.menuItemWithPath("Search", "Search").click();
    JTextComponentFixture searchField = frameFixture.textBox();
    ComponentFinder finder = robot().finder();
    BasePanel panel = finder.findByType(BasePanel.class);
    Collection<BibEntry> entries = panel.getDatabase().getEntries();
    searchField.deleteText().enterText("asdf[");
    Assert.assertTrue(entries.stream().noneMatch(entry -> entry.isSearchHit()));
}
Also used : ComponentFinder(org.assertj.swing.core.ComponentFinder) FailOnThreadViolationRepaintManager(org.assertj.swing.edt.FailOnThreadViolationRepaintManager) BeforeClass(org.junit.BeforeClass) AssertJSwingJUnitTestCase(org.assertj.swing.junit.testcase.AssertJSwingJUnitTestCase) Collection(java.util.Collection) BibEntry(org.jabref.model.entry.BibEntry) WindowFinder(org.assertj.swing.finder.WindowFinder) Test(org.junit.Test) Category(org.junit.experimental.categories.Category) BasePanel(org.jabref.gui.BasePanel) TestUtils(org.jabref.testutils.TestUtils) GUITests(org.jabref.testutils.category.GUITests) TimeUnit(java.util.concurrent.TimeUnit) ComponentFinder(org.assertj.swing.core.ComponentFinder) JTextComponentFixture(org.assertj.swing.fixture.JTextComponentFixture) FrameFixture(org.assertj.swing.fixture.FrameFixture) JFrame(javax.swing.JFrame) Assert(org.junit.Assert) BibEntry(org.jabref.model.entry.BibEntry) BasePanel(org.jabref.gui.BasePanel) JTextComponentFixture(org.assertj.swing.fixture.JTextComponentFixture) Test(org.junit.Test)

Aggregations

Collection (java.util.Collection)3 TimeUnit (java.util.concurrent.TimeUnit)3 JFrame (javax.swing.JFrame)3 ComponentFinder (org.assertj.swing.core.ComponentFinder)3 FailOnThreadViolationRepaintManager (org.assertj.swing.edt.FailOnThreadViolationRepaintManager)3 WindowFinder (org.assertj.swing.finder.WindowFinder)3 FrameFixture (org.assertj.swing.fixture.FrameFixture)3 JTextComponentFixture (org.assertj.swing.fixture.JTextComponentFixture)3 AssertJSwingJUnitTestCase (org.assertj.swing.junit.testcase.AssertJSwingJUnitTestCase)3 BasePanel (org.jabref.gui.BasePanel)3 BibEntry (org.jabref.model.entry.BibEntry)3 TestUtils (org.jabref.testutils.TestUtils)3 GUITests (org.jabref.testutils.category.GUITests)3 Assert (org.junit.Assert)3 BeforeClass (org.junit.BeforeClass)3 Test (org.junit.Test)3 Category (org.junit.experimental.categories.Category)3