當前位置: 首頁>>代碼示例>>Java>>正文


Java AssertJUnit.assertEquals方法代碼示例

本文整理匯總了Java中org.testng.AssertJUnit.assertEquals方法的典型用法代碼示例。如果您正苦於以下問題:Java AssertJUnit.assertEquals方法的具體用法?Java AssertJUnit.assertEquals怎麽用?Java AssertJUnit.assertEquals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.testng.AssertJUnit的用法示例。


在下文中一共展示了AssertJUnit.assertEquals方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: selectEdiotrDate

import org.testng.AssertJUnit; //導入方法依賴的package包/類
@Test public void selectEdiotrDate() {
    Set<Node> datePickerNodes = getPrimaryStage().getScene().getRoot().lookupAll(".date-picker");
    List<Node> pickers = new ArrayList<>(datePickerNodes);
    DatePicker datePickerNode = (DatePicker) pickers.get(1);
    IJavaFXElement datePicker = datePickers.get(1);
    Platform.runLater(() -> {
        datePicker.marathon_select(dateString);
    });
    List<Object> dates = new ArrayList<>();
    Platform.runLater(() -> {
        LocalDate value = datePickerNode.getValue();
        dates.add(datePickerNode.getConverter().toString(value));
    });
    new Wait("Waiting for date to be set.") {
        @Override public boolean until() {
            return dates.size() > 0;
        }
    };
    AssertJUnit.assertEquals(dateString, dates.get(0));
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:21,代碼來源:JavaFXDatePickerElementTest.java

示例2: getText

import org.testng.AssertJUnit; //導入方法依賴的package包/類
@Test public void getText() {
    final TextField textField = (TextField) getPrimaryStage().getScene().getRoot().lookup(".text-field");
    LoggingRecorder lr = new LoggingRecorder();
    List<Object> text = new ArrayList<>();
    Platform.runLater(() -> {
        RFXComponent rTextField = new RFXTextInputControl(textField, null, null, lr);
        textField.setText("Hello World");
        rTextField.focusLost(null);
        text.add(rTextField.getAttribute("text"));
    });
    new Wait("Waiting for text field text.") {
        @Override public boolean until() {
            return text.size() > 0;
        }
    };
    AssertJUnit.assertEquals("Hello World", text.get(0));
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:18,代碼來源:RFXTextFieldTest.java

示例3: clickTabItem

import org.testng.AssertJUnit; //導入方法依賴的package包/類
public void clickTabItem() throws Throwable {
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override public void run() {
            frame.setSize(100, frame.getHeight());
        }
    });
    driver = new JavaDriver();
    final List<WebElement> tabs = driver.findElements(By.cssSelector("tabbed-pane::nth-tab(4)"));
    AssertJUnit.assertEquals(1, tabs.size());
    new Wait("Wait for tab4 to non-displayable") {
        @Override public boolean until() {
            return !tabs.get(0).isDisplayed();
        }
    };
    AssertJUnit.assertFalse(tabs.get(0).isDisplayed());
    tabs.get(0).click();
    AssertJUnit.assertTrue(tabs.get(0).isDisplayed());
    WebElement tabbedPane = driver.findElement(By.cssSelector("tabbed-pane"));
    AssertJUnit.assertEquals("" + 3, tabbedPane.getAttribute("selectedIndex"));
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:21,代碼來源:JTabbedPaneTest.java

示例4: getText

import org.testng.AssertJUnit; //導入方法依賴的package包/類
@Test public void getText() {
    HTMLEditor editor = (HTMLEditor) getPrimaryStage().getScene().getRoot().lookup(".html-editor");
    LoggingRecorder lr = new LoggingRecorder();
    String text = "This is a test text";
    final String htmlText = "<html><font color=\"RED\"><h1><This is also content>" + text + "</h1></html>";
    List<String> attributeText = new ArrayList<>();
    Platform.runLater(() -> {
        RFXHTMLEditor rfxhtmlEditor = new RFXHTMLEditor(editor, null, null, lr);
        editor.setHtmlText(htmlText);
        rfxhtmlEditor.focusLost(null);
        attributeText.add(rfxhtmlEditor.getAttribute("text"));
    });
    new Wait("Waiting for html editor text.") {
        @Override public boolean until() {
            return attributeText.size() > 0;
        }
    };
    AssertJUnit.assertEquals(htmlText, attributeText.get(0));
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:20,代碼來源:RFXHTMLEditorTest.java

示例5: multpleNodesSelected

import org.testng.AssertJUnit; //導入方法依賴的package包/類
public void multpleNodesSelected() throws Throwable, InvocationTargetException {
    final JTree tree = (JTree) ComponentUtils.findComponent(JTree.class, frame);
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
    siw(new Runnable() {
        @Override public void run() {
            tree.expandRow(0);
            tree.setSelectionRows(new int[] { 0, 2 });
        }
    });
    final LoggingRecorder lr = new LoggingRecorder();
    siw(new Runnable() {
        @Override public void run() {
            RTree rTree = new RTree(tree, null, null, lr);
            rTree.focusLost(null);
        }
    });
    Call call = lr.getCall();
    AssertJUnit.assertEquals("select", call.getFunction());
    AssertJUnit.assertEquals("[/Root Node, /Root Node/Parent 2]", call.getState());
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:21,代碼來源:RTreeTest.java

示例6: sendKeysKeyboardMap

import org.testng.AssertJUnit; //導入方法依賴的package包/類
public void sendKeysKeyboardMap() throws Throwable {
    if (System.getProperty("java.version", "").matches("1.7.*") && isRobot()) {
        throw new SkipException("Fails on Java 1.7, looks like some problem with Robot in 1.7");
    }
    kss.clear();
    driver.sendKeys(textField, "A");
    new WaitWithoutException("Waiting for the keypress") {
        @Override public boolean until() {
            try {
                return kss.toString().contains(KeyStroke.getKeyStroke("released SHIFT").toString());
            } catch (Throwable t) {
                return false;
            }
        }
    };
    List<KeyStroke> expected = Arrays.asList(KeyStroke.getKeyStroke("shift pressed SHIFT"),
            KeyStroke.getKeyStroke("shift pressed A"), KeyStroke.getKeyStroke("shift typed A"),
            KeyStroke.getKeyStroke("shift released A"), KeyStroke.getKeyStroke("released SHIFT"));
    AssertJUnit.assertEquals(expected.toString(), kss.toString());
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:21,代碼來源:DeviceKBTest.java

示例7: getCellEditor

import org.testng.AssertJUnit; //導入方法依賴的package包/類
public void getCellEditor() throws Throwable {
    driver = new JavaDriver();
    WebElement cell = driver.findElement(By.cssSelector("table::mnth-cell(1,2)::editor"));
    AssertJUnit.assertEquals("button", cell.getTagName());
    cell.click();
    driver.switchTo().window("Pick a Color");
    WebElement tab = driver.findElement(By.cssSelector("tabbed-pane::all-tabs[text='RGB']"));
    tab.click();
    WebElement tabcomponent = driver.findElement(By.cssSelector("tabbed-pane::all-tabs[text='RGB']::component"));
    List<WebElement> spinners = tabcomponent.findElements(By.cssSelector("spinner"));
    List<WebElement> all = spinners.get(0).findElements(By.cssSelector("*"));
    List<String> s = new ArrayList<String>();
    for (WebElement webElement : all) {
        s.add(webElement.getTagName());
    }
    WebElement tf = spinners.get(0).findElement(By.cssSelector("formatted-text-field"));
    tf.clear();
    tf.sendKeys("234", Keys.TAB);
    driver.findElement(By.cssSelector("button[text='OK']")).click();
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:21,代碼來源:JTableDialogEditTest.java

示例8: getWindowHandles

import org.testng.AssertJUnit; //導入方法依賴的package包/類
public void getWindowHandles() throws Throwable {
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override public void run() {
            d2 = new JDialog(frame, false);
            d2.setTitle("My Dialog 2");
            d2.pack();
            d2.setVisible(true);
        }
    });
    Collection<String> windowHandles = driver.getWindowHandles();
    AssertJUnit.assertEquals(2, windowHandles.size());
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override public void run() {
            d2.dispose();
        }
    });
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:18,代碼來源:JavaAgentTest.java

示例9: getText

import org.testng.AssertJUnit; //導入方法依賴的package包/類
@Test public void getText() {
    @SuppressWarnings("rawtypes")
    TreeView treeView = (TreeView) getPrimaryStage().getScene().getRoot().lookup(".tree-view");
    LoggingRecorder lr = new LoggingRecorder();
    List<String> text = new ArrayList<>();
    Platform.runLater(new Runnable() {
        @Override public void run() {
            RFXTreeView rTreeView = new RFXTreeView(treeView, null, null, lr);
            treeView.getSelectionModel().select(2);
            rTreeView.focusLost(new RFXTreeView(null, null, null, null));
            text.add(rTreeView.getAttribute("text"));
        }
    });
    new Wait("Waiting for tree text.") {
        @Override public boolean until() {
            return text.size() > 0;
        }
    };
    AssertJUnit.assertEquals("[\"/Root node/Child Node 2\"]", text.get(0));
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:21,代碼來源:RFXTreeViewTest.java

示例10: clear

import org.testng.AssertJUnit; //導入方法依賴的package包/類
public void clear() throws Throwable {
    driver = new JavaDriver();
    WebElement textField = driver.findElement(By.cssSelector("text-field"));
    textField.clear();
    AssertJUnit.assertEquals("", textField.getText());
    textField.sendKeys("Lewis Carroll");
    AssertJUnit.assertEquals("Lewis Carroll", textField.getText());
    textField.clear();
    AssertJUnit.assertEquals("", textField.getText());
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:11,代碼來源:JTextFieldTest.java

示例11: duplicateSelection

import org.testng.AssertJUnit; //導入方法依賴的package包/類
public void duplicateSelection() {
    IJavaElement comboBox = driver.findElementByTagName("combo-box");
    marathon_select(comboBox, "Larry(1)");
    IJavaElement editor = comboBox.findElementByTagName("text-field");
    String attribute = editor.getAttribute("text");
    String selectedIndex = comboBox.getAttribute("selectedIndex");
    AssertJUnit.assertEquals("Larry", attribute);
    AssertJUnit.assertEquals(4, Integer.parseInt(selectedIndex));
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:10,代碼來源:JComboBoxJavaElement2Test.java

示例12: select

import org.testng.AssertJUnit; //導入方法依賴的package包/類
@Test public void select() {
    HTMLEditor editor = (HTMLEditor) getPrimaryStage().getScene().getRoot().lookup(".html-editor");
    LoggingRecorder lr = new LoggingRecorder();
    String text = "This is a test text";
    final String htmlText = "<html><font color=\"RED\"><h1><This is also content>" + text + "</h1></html>";
    Platform.runLater(() -> {
        RFXHTMLEditor rfxhtmlEditor = new RFXHTMLEditor(editor, null, null, lr);
        editor.setHtmlText(htmlText);
        rfxhtmlEditor.focusLost(null);
    });
    List<Recording> recordings = lr.waitAndGetRecordings(1);
    Recording recording = recordings.get(0);
    AssertJUnit.assertEquals("recordSelect", recording.getCall());
    AssertJUnit.assertEquals(htmlText, recording.getParameters()[0]);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:16,代碼來源:RFXHTMLEditorTest.java

示例13: getAttributeText

import org.testng.AssertJUnit; //導入方法依賴的package包/類
@Test public void getAttributeText() {
    AssertJUnit.assertEquals("Text", textField.getText());
    Platform.runLater(() -> {
        textField.marathon_select("Hello World");
    });
    new Wait("Waiting for the text field text") {
        @Override public boolean until() {
            return textField.getAttribute("text").equals("Hello World");
        }
    };
    AssertJUnit.assertEquals("Hello World", textField.getAttribute("text"));
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:13,代碼來源:JavaFXTextFieldElementTest.java

示例14: getAttributes

import org.testng.AssertJUnit; //導入方法依賴的package包/類
public void getAttributes() throws Throwable {
    driver = new JavaDriver();
    WebElement splitPane = driver.findElement(By.cssSelector("split-pane"));
    AssertJUnit.assertEquals("150", splitPane.getAttribute("dividerLocation"));
    WebElement splitpaneDivider = driver
            .findElement(By.cssSelector(":instance-of('javax.swing.plaf.basic.BasicSplitPaneDivider')"));
    new Actions(driver).moveToElement(splitpaneDivider).dragAndDropBy(splitpaneDivider, 25, 25).perform();
    AssertJUnit.assertEquals("175", splitPane.getAttribute("dividerLocation"));
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:10,代碼來源:JSplitPaneTest.java

示例15: selectCheckboxNotSelectedNotSelected

import org.testng.AssertJUnit; //導入方法依賴的package包/類
@Test public void selectCheckboxNotSelectedNotSelected() throws Throwable {
    CheckBox checkBoxNode = (CheckBox) getPrimaryStage().getScene().getRoot().lookup(".check-box");
    AssertJUnit.assertEquals(false, checkBoxNode.isSelected());
    checkBox.marathon_select("unchecked");
    new Wait("Waiting for the check box deselect.") {
        @Override public boolean until() {
            return !checkBoxNode.isSelected();
        }
    };
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:11,代碼來源:JavaFXCheckBoxElementTest.java


注:本文中的org.testng.AssertJUnit.assertEquals方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。