Search in sources :

Example 6 with Nonnull

use of org.assertj.swing.dependency.jsr305.Nonnull in project jabref by JabRef.

the class IdFetcherDialogTest method testFetcherDialog.

@Test
public void testFetcherDialog() {
    mainFrame.menuItemWithPath("File", "New " + databaseMode + " database").click();
    JTableFixture entryTable = mainFrame.table();
    entryTable.requireRowCount(0);
    mainFrame.menuItemWithPath("BibTeX", "New entry...").click();
    GenericTypeMatcher<JDialog> matcher = new GenericTypeMatcher<JDialog>(JDialog.class) {

        @Override
        protected boolean isMatching(JDialog dialog) {
            return "Select entry type".equals(dialog.getTitle());
        }
    };
    findDialog(matcher).withTimeout(10_000).using(robot()).comboBox(new GenericTypeMatcher<JComboBox>(JComboBox.class) {

        @Override
        protected boolean isMatching(@Nonnull JComboBox component) {
            return true;
        }
    }).selectItem(fetcherType);
    findDialog(matcher).withTimeout(10_000).using(robot()).textBox(new GenericTypeMatcher<JTextComponent>(JTextComponent.class) {

        @Override
        protected boolean isMatching(@Nonnull JTextComponent component) {
            return true;
        }
    }).enterText(fetchID);
    findDialog(matcher).withTimeout(10_000).using(robot()).button(new GenericTypeMatcher<JButton>(JButton.class) {

        @Override
        protected boolean isMatching(@Nonnull JButton jButton) {
            return "Generate".equals(jButton.getText());
        }
    }).click();
    pause(new Condition("entrySize") {

        @Override
        public boolean test() {
            return entryTable.rowCount() == 1;
        }
    }, 10_000);
    entryTable.requireRowCount(1);
}
Also used : Condition(org.assertj.swing.timing.Condition) JTableFixture(org.assertj.swing.fixture.JTableFixture) JComboBox(javax.swing.JComboBox) Nonnull(org.assertj.swing.dependency.jsr305.Nonnull) JButton(javax.swing.JButton) JTextComponent(javax.swing.text.JTextComponent) GenericTypeMatcher(org.assertj.swing.core.GenericTypeMatcher) JDialog(javax.swing.JDialog) Test(org.junit.Test)

Example 7 with Nonnull

use of org.assertj.swing.dependency.jsr305.Nonnull in project jabref by JabRef.

the class ParameterizedDialogNewEntryTest method addEntryPlainTextOfGivenType.

@Test
public void addEntryPlainTextOfGivenType() {
    mainFrame.menuItemWithPath("File", "New " + databaseMode + " database").click();
    JTableFixture entryTable = mainFrame.table();
    entryTable.requireRowCount(0);
    mainFrame.menuItemWithPath("BibTeX", "New entry from plain text...").click();
    selectEntryType();
    GenericTypeMatcher<JDialog> matcher2 = plainTextMatcher();
    findDialog(matcher2).withTimeout(10_000).using(robot()).button(new GenericTypeMatcher<JButton>(JButton.class) {

        @Override
        protected boolean isMatching(@Nonnull JButton jButton) {
            return "Accept".equals(jButton.getText());
        }
    }).click();
    entryTable.requireRowCount(1);
}
Also used : JTableFixture(org.assertj.swing.fixture.JTableFixture) Nonnull(org.assertj.swing.dependency.jsr305.Nonnull) JButton(javax.swing.JButton) GenericTypeMatcher(org.assertj.swing.core.GenericTypeMatcher) JDialog(javax.swing.JDialog) Test(org.junit.Test)

Aggregations

JButton (javax.swing.JButton)7 GenericTypeMatcher (org.assertj.swing.core.GenericTypeMatcher)7 Nonnull (org.assertj.swing.dependency.jsr305.Nonnull)7 Test (org.junit.Test)7 JTableFixture (org.assertj.swing.fixture.JTableFixture)5 JDialog (javax.swing.JDialog)4 DialogFixture (org.assertj.swing.fixture.DialogFixture)2 JComboBox (javax.swing.JComboBox)1 JTextComponent (javax.swing.text.JTextComponent)1 Condition (org.assertj.swing.timing.Condition)1