本文整理匯總了Java中org.testng.AssertJUnit類的典型用法代碼示例。如果您正苦於以下問題:Java AssertJUnit類的具體用法?Java AssertJUnit怎麽用?Java AssertJUnit使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
AssertJUnit類屬於org.testng包,在下文中一共展示了AssertJUnit類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: radioButtonMenuItemClick
import org.testng.AssertJUnit; //導入依賴的package包/類
public void radioButtonMenuItemClick() throws Throwable {
driver = new JavaDriver();
WebElement menu = driver.findElement(By.cssSelector("menu"));
AssertJUnit.assertEquals("A Menu", menu.getText());
new Actions(driver).moveToElement(menu).click().perform();
List<WebElement> menuItems = driver.findElements(By.cssSelector("radio-button-menu-item"));
int i = menuItems.size();
assertMenuItemClick(menuItems, --i, "Another one (an instance of JRadioButtonMenuItem)\n");
WebElement currRadioButton = menuItems.get(i);
AssertJUnit.assertEquals("true", currRadioButton.getAttribute("selected"));
new Actions(driver).moveToElement(menu).click().perform();
assertMenuItemClick(menuItems, --i, "A radio button menu item (an instance of JRadioButtonMenuItem)\n");
currRadioButton = menuItems.get(i);
new Actions(driver).moveToElement(menu).click().perform();
AssertJUnit.assertEquals("true", currRadioButton.getAttribute("selected"));
}
示例2: columnSelection
import org.testng.AssertJUnit; //導入依賴的package包/類
public void columnSelection() throws Throwable {
driver = new JavaDriver();
List<WebElement> checkboxes = driver.findElements(By.cssSelector("check-box"));
// Setting Column Selection
checkboxes.get(1).click();
List<WebElement> radiobuttons = driver.findElements(By.cssSelector("radio-button"));
// Setting Single Selection
radiobuttons.get(1).click();
WebElement table = driver.findElement(By.cssSelector("table"));
int columnCount = new Integer(table.getAttribute("columnCount"));
AssertJUnit.assertEquals(5, columnCount);
for (int colNum = 0; colNum < columnCount; colNum++) {
assertClickOnColumn(table, colNum);
}
assertShiftClickSingleSelection(table);
}
示例3: testClassificationStreamProcessorExtension6
import org.testng.AssertJUnit; //導入依賴的package包/類
@Test
public void testClassificationStreamProcessorExtension6() throws InterruptedException {
logger.info("HoeffdingClassifierStreamProcessorExtension TestCase - Incompatible model");
SiddhiManager siddhiManager = new SiddhiManager();
String inStreamDefinition = "define stream StreamA (attribute_0 double, attribute_1 double, attribute_2 " +
"double, attribute_3 double);";
String query = ("@info(name = 'query1') from StreamA#streamingml:hoeffdingTreeClassifier('model1', " +
"attribute_0, attribute_1, attribute_2) \n"
+ "select attribute_0, attribute_1, attribute_2, attribute_3, prediction, confidenceLevel " +
"insert into outputStream;");
try {
SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(trainingStream +
inStreamDefinition + trainingQuery + query);
AssertJUnit.fail();
} catch (Exception e) {
logger.error(e.getCause().getMessage());
AssertJUnit.assertTrue(e instanceof SiddhiAppCreationException);
AssertJUnit.assertTrue(e.getCause().getMessage().contains("Invalid number of feature attributes " +
"for streamingml:hoeffdingTreeClassifier. This Stream Processor is defined with " +
"4 features, but found 3 feature"));
}
}
開發者ID:wso2-extensions,項目名稱:siddhi-gpl-execution-streamingml,代碼行數:25,代碼來源:HoeffdingClassifierStreamProcessorExtensionTestCase.java
示例4: select
import org.testng.AssertJUnit; //導入依賴的package包/類
@Test public void select() {
@SuppressWarnings("unchecked")
ListView<String> listView = (ListView<String>) getPrimaryStage().getScene().getRoot().lookup(".list-view");
LoggingRecorder lr = new LoggingRecorder();
Platform.runLater(() -> {
@SuppressWarnings("unchecked")
ChoiceBoxListCell<String> cell = (ChoiceBoxListCell<String>) getCellAt(listView, 3);
Point2D point = getPoint(listView, 3);
RFXListView rfxListView = new RFXListView(listView, null, point, lr);
rfxListView.focusGained(rfxListView);
cell.startEdit();
cell.updateItem("Option 3", false);
cell.commitEdit("Option 3");
rfxListView.focusLost(rfxListView);
});
List<Recording> recordings = lr.waitAndGetRecordings(1);
Recording recording = recordings.get(0);
AssertJUnit.assertEquals("recordSelect", recording.getCall());
AssertJUnit.assertEquals("Option 3", recording.getParameters()[0]);
}
示例5: jsonSourceMapperTest15
import org.testng.AssertJUnit; //導入依賴的package包/類
@Test
public void jsonSourceMapperTest15() throws InterruptedException {
log.info("test JsonSourceMapper with test json missing attribute");
log = Logger.getLogger(JsonSourceMapper.class);
UnitTestAppender appender = new UnitTestAppender();
log.addAppender(appender);
String streams = "" +
"@App:name('TestSiddhiApp')" +
"@source(type='inMemory', topic='stock', @map(type='json')) " +
"define stream FooStream (symbol string, price float, volume long); " +
"define stream BarStream (symbol string, price float, volume long); ";
String query = "" +
"from FooStream " +
"select * " +
"insert into BarStream; ";
SiddhiManager siddhiManager = new SiddhiManager();
SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(streams + query);
siddhiAppRuntime.start();
InMemoryBroker.publish("stock", "12");
AssertJUnit.assertTrue(appender.getMessages().contains("Json message 12 contains missing attributes"));
siddhiAppRuntime.shutdown();
}
示例6: assertContentDuplicates
import org.testng.AssertJUnit; //導入依賴的package包/類
public void assertContentDuplicates() throws InterruptedException {
siw(new Runnable() {
@Override public void run() {
combo = (JComboBox) ComponentUtils.findComponent(JComboBox.class, frame);
}
});
final RComboBox rCombo = new RComboBox(combo, null, null, new LoggingRecorder());
final Object[] content = new Object[] { null };
siw(new Runnable() {
@Override public void run() {
content[0] = rCombo.getContent();
}
});
JSONArray a = new JSONArray(content[0]);
AssertJUnit.assertEquals("[[\"Phillip\",\"Larry\",\"Lisa\",\"James\",\"Larry(1)\"]]", a.toString());
}
示例7: 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());
}
示例8: nextTokenOperators
import org.testng.AssertJUnit; //導入依賴的package包/類
public void nextTokenOperators() throws Throwable {
SelectorLexer selectorLexer = new SelectorLexer(">+~=^=$=*=");
Token nextToken;
nextToken = selectorLexer.nextToken();
AssertJUnit.assertEquals(TokenType.TT_GREATER, nextToken.getType());
nextToken = selectorLexer.nextToken();
AssertJUnit.assertEquals(TokenType.TT_PLUS, nextToken.getType());
nextToken = selectorLexer.nextToken();
AssertJUnit.assertEquals(TokenType.TT_TILDE, nextToken.getType());
nextToken = selectorLexer.nextToken();
AssertJUnit.assertEquals(TokenType.TT_EQUALS, nextToken.getType());
nextToken = selectorLexer.nextToken();
AssertJUnit.assertEquals(TokenType.TT_PREFIXMATCH, nextToken.getType());
nextToken = selectorLexer.nextToken();
AssertJUnit.assertEquals(TokenType.TT_SUFFIXMATCH, nextToken.getType());
nextToken = selectorLexer.nextToken();
AssertJUnit.assertEquals(TokenType.TT_SUBSTRINGMATCH, nextToken.getType());
}
示例9: getAttributes
import org.testng.AssertJUnit; //導入依賴的package包/類
void getAttributes() throws Throwable {
driver = new JavaDriver();
List<WebElement> radioButtons = driver.findElements(By.cssSelector("radio-button"));
AssertJUnit.assertEquals(5, radioButtons.size());
AssertJUnit.assertEquals("Bird", radioButtons.get(0).getAttribute("buttonText"));
AssertJUnit.assertEquals("true", radioButtons.get(0).getAttribute("selected"));
AssertJUnit.assertEquals("Cat", radioButtons.get(1).getAttribute("buttonText"));
AssertJUnit.assertEquals("false", radioButtons.get(1).getAttribute("selected"));
radioButtons.get(1).click();
AssertJUnit.assertEquals("false", radioButtons.get(0).getAttribute("selected"));
AssertJUnit.assertEquals("true", radioButtons.get(1).getAttribute("selected"));
AssertJUnit.assertEquals("false", radioButtons.get(2).getAttribute("selected"));
AssertJUnit.assertEquals("false", radioButtons.get(3).getAttribute("selected"));
AssertJUnit.assertEquals("false", radioButtons.get(4).getAttribute("selected"));
AssertJUnit.assertEquals("Pig", radioButtons.get(4).getAttribute("actionCommand"));
}
示例10: 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();
}
示例11: clickWithNativeEvents
import org.testng.AssertJUnit; //導入依賴的package包/類
public void clickWithNativeEvents() throws Throwable {
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("nativeEvents", true);
driver = new JavaDriver(new JavaProfile(), caps, caps);
SwingUtilities.invokeAndWait(new Runnable() {
@Override public void run() {
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
});
WebElement element1 = driver.findElement(By.name("click-me"));
element1.click();
AssertJUnit.assertTrue(buttonClicked);
buttonClicked = false;
new Actions(driver).click().perform();
AssertJUnit.assertTrue(buttonClicked);
AssertJUnit.assertTrue(buttonMouseActions.toString().contains("clicked(1)"));
buttonMouseActions.setLength(0);
new Actions(driver).contextClick().perform();
AssertJUnit.assertTrue(buttonMouseActions.toString(), buttonMouseActions.toString().contains("pressed(3-popup)")
|| buttonMouseActions.toString().contains("released(3-popup)"));
}
示例12: click
import org.testng.AssertJUnit; //導入依賴的package包/類
public void click() throws Throwable {
driver = new JavaDriver();
List<WebElement> buttons = driver.findElements(By.cssSelector("button"));
AssertJUnit.assertEquals(3, buttons.size());
WebElement b1 = buttons.get(0);
AssertJUnit.assertEquals("<html><center><b><u>D</u>isable</b><br><font color=#ffffdd>middle button</font>", b1.getText());
WebElement b2 = buttons.get(1);
AssertJUnit.assertEquals("middle button", b2.getText());
WebElement b3 = buttons.get(2);
AssertJUnit.assertEquals("<html><center><b><u>E</u>nable</b><br><font color=#ffffdd>middle button</font>", b3.getText());
AssertJUnit.assertEquals("true", b1.getAttribute("enabled"));
AssertJUnit.assertEquals("true", b2.getAttribute("enabled"));
AssertJUnit.assertEquals("false", b3.getAttribute("enabled"));
b1.click();
AssertJUnit.assertEquals("false", b1.getAttribute("enabled"));
AssertJUnit.assertEquals("false", b2.getAttribute("enabled"));
AssertJUnit.assertEquals("true", b3.getAttribute("enabled"));
}
示例13: selectForHomeDirFileSelection
import org.testng.AssertJUnit; //導入依賴的package包/類
public void selectForHomeDirFileSelection() throws Throwable {
IJavaElement button = driver.findElementByTagName("button");
button.click();
new DeviceTest.WaitWithoutException("Waiting for the window to open") {
@Override public boolean until() {
try {
driver.switchTo().window("Open");
return true;
} catch (Throwable t) {
}
return false;
}
};
driver.switchTo().window("Open");
IJavaElement fc = driver.findElementByTagName("file-chooser");
File file = new File(System.getProperty("user.home"));
marathon_select(fc, file.getAbsolutePath());
String attribute = fc.getAttribute("selectedFile");
AssertJUnit.assertEquals(file.getAbsoluteFile().toString(), attribute);
}
示例14: testHoeffdingClassifierLearningExtension4
import org.testng.AssertJUnit; //導入依賴的package包/類
@Test
public void testHoeffdingClassifierLearningExtension4() throws InterruptedException {
logger.info("HoeffdingClassifierUpdaterStreamProcessorExtension TestCase - Label is not of type string or "
+ "bool");
SiddhiManager siddhiManager = new SiddhiManager();
String inStreamDefinition = "define stream StreamA (attribute_0 double, attribute_1 double, attribute_2 "
+ "double, attribute_3 double, attribute_4 int );";
String query = ("@info(name = 'query1') from StreamA#streamingml:updateHoeffdingTree('model1', 3, "
+ "attribute_0, attribute_1 , attribute_2 ,attribute_3,attribute_4) select attribute_0, "
+ "attribute_1, attribute_2, attribute_3, accuracy insert into"
+ " outputStream;");
try {
SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(inStreamDefinition + query);
} catch (Exception e) {
logger.error(e.getCause().getMessage());
AssertJUnit.assertTrue(e instanceof SiddhiAppCreationException);
AssertJUnit.assertTrue(e.getCause().getMessage().contains("[label attribute] in 6 th index of "
+ "classifierUpdate should be either a BOOL or a STRING but found INT"));
}
}
開發者ID:wso2-extensions,項目名稱:siddhi-gpl-execution-streamingml,代碼行數:24,代碼來源:HoeffdingClassifierUpdaterStreamProcessorExtensionTestCase.java
示例15: select
import org.testng.AssertJUnit; //導入依賴的package包/類
@Test public void select() {
@SuppressWarnings("unchecked")
ListView<String> listView = (ListView<String>) getPrimaryStage().getScene().getRoot().lookup(".list-view");
LoggingRecorder lr = new LoggingRecorder();
Platform.runLater(() -> {
@SuppressWarnings("unchecked")
ComboBoxListCell<String> cell = (ComboBoxListCell<String>) getCellAt(listView, 3);
Point2D point = getPoint(listView, 3);
RFXListView rfxListView = new RFXListView(listView, null, point, lr);
rfxListView.focusGained(rfxListView);
cell.startEdit();
cell.updateItem("Option 3", false);
cell.commitEdit("Option 3");
rfxListView.focusLost(rfxListView);
});
List<Recording> recordings = lr.waitAndGetRecordings(1);
Recording recording = recordings.get(0);
AssertJUnit.assertEquals("recordSelect", recording.getCall());
AssertJUnit.assertEquals("Option 3", recording.getParameters()[0]);
}