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


Java AssertJUnit.assertNotNull方法代碼示例

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


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

示例1: progress

import org.testng.AssertJUnit; //導入方法依賴的package包/類
public void progress() throws Throwable {
    driver = new JavaDriver();
    final WebElement progressbar = driver.findElement(By.cssSelector("progress-bar"));
    AssertJUnit.assertNotNull("could not find progress-bar", progressbar);
    AssertJUnit.assertEquals("0", progressbar.getAttribute("value"));
    driver.findElement(By.cssSelector("button")).click();

    Wait<WebDriver> wait = new WebDriverWait(driver, 30);
    // Wait for a process to complete
    wait.until(new ExpectedCondition<Boolean>() {
        @Override public Boolean apply(WebDriver webDriver) {
            return progressbar.getAttribute("value").equals("100");
        }
    });

    AssertJUnit.assertEquals("100", progressbar.getAttribute("value"));
    AssertJUnit.assertTrue(driver.findElement(By.cssSelector("text-area")).getText().contains("Done!"));
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:19,代碼來源:JProgressBarTest.java

示例2: switchTo

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

示例3: findElementsOfElement

import org.testng.AssertJUnit; //導入方法依賴的package包/類
public void findElementsOfElement() throws Throwable {
    driver = new JavaDriver();
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override public void run() {
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        }
    });
    WebElement element = driver.findElement(By.name("box-panel"));
    AssertJUnit.assertNotNull(element);
    List<WebElement> clickMe = element.findElements(By.name("click-me"));
    AssertJUnit.assertNotNull(clickMe);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:14,代碼來源:JavaDriverTest.java

示例4: findElement

import org.testng.AssertJUnit; //導入方法依賴的package包/類
public void findElement() throws Throwable {
    driver = new JavaDriver();
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override public void run() {
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        }
    });
    WebElement element = driver.findElement(By.name("click-me"));
    AssertJUnit.assertNotNull(element);
    AssertJUnit.assertEquals(EventQueueWait.call(button, "getText"), element.getText());
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:13,代碼來源:JavaDriverTest.java

示例5: simpleSelectorWithFunctionAll

import org.testng.AssertJUnit; //導入方法依賴的package包/類
public void simpleSelectorWithFunctionAll() throws Throwable {
    IJavaElement element = driver.findElementByCssSelector("button:enabled");
    AssertJUnit.assertNotNull(element);
    AssertJUnit.assertEquals(EventQueueWait.call(button, "getName"), element.getAttribute("name"));
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override public void run() {
            button.setEnabled(false);
        }
    });
    element = driver.findElementByCssSelector("button:disabled");
    AssertJUnit.assertNotNull(element);
    AssertJUnit.assertEquals(EventQueueWait.call(button, "getName"), element.getAttribute("name"));
    element = driver.findElementByCssSelector("button:displayed");
    AssertJUnit.assertNotNull(element);
    AssertJUnit.assertEquals(EventQueueWait.call(button, "getName"), element.getAttribute("name"));
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override public void run() {
            button.setVisible(false);
        }
    });
    element = driver.findElementByCssSelector("button:hidden");
    AssertJUnit.assertNotNull(element);
    AssertJUnit.assertEquals(EventQueueWait.call(button, "getName"), element.getAttribute("name"));
    element = driver.findElementByCssSelector(":instance-of('javax.swing.JButton')");
    AssertJUnit.assertNotNull(element);
    AssertJUnit.assertEquals(EventQueueWait.call(button, "getName"), element.getAttribute("name"));
    element = driver.findElementByCssSelector("check-box:deselected");
    AssertJUnit.assertNotNull(element);
    AssertJUnit.assertEquals(EventQueueWait.call(checkbox, "getName"), element.getAttribute("name"));
    element = driver.findElementByCssSelector(":instance-of('javax.swing.JCheckBox'):deselected");
    AssertJUnit.assertNotNull(element);
    AssertJUnit.assertEquals(EventQueueWait.call(checkbox, "getName"), element.getAttribute("name"));
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:34,代碼來源:FindByCssSelectorTest.java

示例6: findElementsByTagNameOfElement

import org.testng.AssertJUnit; //導入方法依賴的package包/類
public void findElementsByTagNameOfElement() throws Throwable {
    driver = new JavaDriver();
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override public void run() {
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        }
    });
    WebElement parent = driver.findElement(By.tagName("box"));
    List<WebElement> elements = parent.findElements(By.tagName("label"));
    AssertJUnit.assertNotNull(elements);
    AssertJUnit.assertEquals(2, elements.size());
    AssertJUnit.assertEquals("Enter The Text", elements.get(0).getText());
    AssertJUnit.assertEquals("Text Field", elements.get(1).getText());
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:16,代碼來源:JavaDriverTest.java

示例7: simpleSelector

import org.testng.AssertJUnit; //導入方法依賴的package包/類
public void simpleSelector() throws Throwable {
    IJavaElement element = driver.findElementByCssSelector("button");
    AssertJUnit.assertNotNull(element);
    AssertJUnit.assertEquals(EventQueueWait.call(button, "getName"), element.getAttribute("name"));
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:6,代碼來源:FindByCssSelectorTest.java

示例8: getAttribute

import org.testng.AssertJUnit; //導入方法依賴的package包/類
public void getAttribute() throws Throwable {
    String attribute = ejText.getAttribute("size");
    AssertJUnit.assertNotNull(attribute);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:5,代碼來源:JavaElementTest.java

示例9: parseSelfSelector

import org.testng.AssertJUnit; //導入方法依賴的package包/類
public void parseSelfSelector() throws Throwable {
    SelectorParser parser = new SelectorParser(".::selected");
    Selector selector = parser.parse();
    AssertJUnit.assertNotNull(selector);
    AssertJUnit.assertEquals(".::selected", selector.toString());
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:7,代碼來源:SelectorParserTest.java

示例10: getLocation

import org.testng.AssertJUnit; //導入方法依賴的package包/類
public void getLocation() throws Throwable {
    Point location = ejText.getLocation();
    AssertJUnit.assertNotNull(location);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:5,代碼來源:JavaElementTest.java

示例11: getSize

import org.testng.AssertJUnit; //導入方法依賴的package包/類
public void getSize() throws Throwable {
    Dimension d = ejText.getSize();
    AssertJUnit.assertNotNull(d);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:5,代碼來源:JavaElementTest.java

示例12: parseSelfSelectorWithParamsEscapeBackslash

import org.testng.AssertJUnit; //導入方法依賴的package包/類
public void parseSelfSelectorWithParamsEscapeBackslash() throws Throwable {
    SelectorParser parser = new SelectorParser(".::call-select('Hello\\\\ World')");
    Selector selector = parser.parse();
    AssertJUnit.assertNotNull(selector);
    AssertJUnit.assertEquals(".::call-select(\"Hello\\ World\")", selector.toString());
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:7,代碼來源:SelectorParserTest.java

示例13: parseTagWithIDAsString

import org.testng.AssertJUnit; //導入方法依賴的package包/類
public void parseTagWithIDAsString() throws Throwable {
    SelectorParser parser = new SelectorParser("menu#'main menu'");
    Selector selector = parser.parse();
    AssertJUnit.assertNotNull(selector);
    AssertJUnit.assertEquals("menu#\"main menu\"", selector.toString());
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:7,代碼來源:SelectorParserTest.java

示例14: parseID

import org.testng.AssertJUnit; //導入方法依賴的package包/類
public void parseID() throws Throwable {
    SelectorParser parser = new SelectorParser("#mainmenu");
    Selector selector = parser.parse();
    AssertJUnit.assertNotNull(selector);
    AssertJUnit.assertEquals("*#mainmenu", selector.toString());
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:7,代碼來源:SelectorParserTest.java

示例15: parseSelectorGroupAdjacentSibling

import org.testng.AssertJUnit; //導入方法依賴的package包/類
public void parseSelectorGroupAdjacentSibling() throws Throwable {
    SelectorParser parser = new SelectorParser("menu+menu-item");
    Selector selector = parser.parse();
    AssertJUnit.assertNotNull(selector);
    AssertJUnit.assertEquals("menu + menu-item", selector.toString());
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:7,代碼來源:SelectorParserTest.java


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