本文整理匯總了Java中org.testng.AssertJUnit.assertTrue方法的典型用法代碼示例。如果您正苦於以下問題:Java AssertJUnit.assertTrue方法的具體用法?Java AssertJUnit.assertTrue怎麽用?Java AssertJUnit.assertTrue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.testng.AssertJUnit
的用法示例。
在下文中一共展示了AssertJUnit.assertTrue方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testClusTree2D_10
import org.testng.AssertJUnit; //導入方法依賴的package包/類
@Test
public void testClusTree2D_10() throws Exception {
logger.info("ClusTreeStreamProcessorExtension Test - Test case to validate attribute_1 to be variable");
SiddhiManager siddhiManager = new SiddhiManager();
String inputStream = "define stream InputStream (x double, y double);";
String query = (
"@info(name = 'query1') " +
"from InputStream#streamingml:clusTree(2, 10, 20, 5, 50, x, 3.1f) " +
"select closestCentroidCoordinate1, closestCentroidCoordinate2, x, y " +
"insert into OutputStream;");
try {
SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(inputStream + query);
} catch (Exception e) {
logger.info("Error caught");
AssertJUnit.assertTrue(e instanceof SiddhiAppCreationException);
AssertJUnit.assertTrue(e.getCause().getMessage().contains("7th parameter is not an attribute " +
"(VariableExpressionExecutor) present in the stream definition. Found a " +
"org.wso2.siddhi.core.executor.ConstantExpressionExecutor"));
}
}
開發者ID:wso2-extensions,項目名稱:siddhi-gpl-execution-streamingml,代碼行數:22,代碼來源:ClusTreeStreamProcessorExtensionTest.java
示例2: testDurationAndCalendar3
import org.testng.AssertJUnit; //導入方法依賴的package包/類
@Test
public void testDurationAndCalendar3() {
try {
Calendar cal = new GregorianCalendar();
cal.set(Calendar.SECOND, 59);
DatatypeFactory.newInstance().newDuration(10000).addTo(cal);
AssertJUnit.assertTrue("sec will be 9", cal.get(Calendar.SECOND) == 9);
Date date = new Date();
date.setSeconds(59);
DatatypeFactory.newInstance().newDuration(10000).addTo(date);
AssertJUnit.assertTrue("sec will be 9", date.getSeconds() == 9);
} catch (DatatypeConfigurationException e) {
e.printStackTrace();
}
}
示例3: testRegressionStreamProcessorExtension3
import org.testng.AssertJUnit; //導入方法依賴的package包/類
@Test
public void testRegressionStreamProcessorExtension3() throws InterruptedException {
logger.info("RegressionLearningStreamProcessorExtension TestCase - model.name is not String");
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:AMRulesRegressor(123, "
+ "attribute_0, attribute_1, attribute_2, attribute_3) \n" + ""
+ "select attribute_0, attribute_1, attribute_2, attribute_3, prediction, meanSquaredError "
+ "insert into outputStream;");
try {
SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(inStreamDefinition + query);
AssertJUnit.fail();
} catch (Exception e) {
logger.error(e.getCause().getMessage());
AssertJUnit.assertTrue(e instanceof SiddhiAppCreationException);
AssertJUnit.assertTrue(e.getCause().getMessage().contains("Invalid parameter type found for the model.name"
+ " argument, required STRING, but found INT."));
}
}
開發者ID:wso2-extensions,項目名稱:siddhi-gpl-execution-streamingml,代碼行數:22,代碼來源:AdaptiveModelRulesRegressorStreamProcessorExtensionTestcase.java
示例4: testRegressionStreamProcessorExtension9
import org.testng.AssertJUnit; //導入方法依賴的package包/類
@Test
public void testRegressionStreamProcessorExtension9() throws InterruptedException {
logger.info("RegressionLearningStreamProcessorExtension TestCase - more parameters than needed");
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:AMRulesRegressor('ml', " +
"attribute_0, attribute_1, attribute_2, attribute_3, 2 ) \n" +
"select attribute_0, attribute_1, attribute_2, attribute_3, prediction, meanSquredError " +
"insert into outputStream;");
try {
SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(trainingStream +
inStreamDefinition + trainingQuery + query);
} catch (Exception e) {
logger.error(e.getCause().getMessage());
AssertJUnit.assertTrue(e instanceof SiddhiAppCreationException);
AssertJUnit.assertTrue(e.getCause().getMessage().contains("Invalid number of parameters for " +
"streamingml:AMRulesRegressor. This Stream Processor requires 5 parameters, " +
"namely, model.name and 4 feature_attributes"));
}
}
開發者ID:wso2-extensions,項目名稱:siddhi-gpl-execution-streamingml,代碼行數:23,代碼來源:AdaptiveModelRulesRegressorStreamProcessorExtensionTestcase.java
示例5: testUpdateUpdateRegressionLearningStreamProcessorExtension7
import org.testng.AssertJUnit; //導入方法依賴的package包/類
@Test
public void testUpdateUpdateRegressionLearningStreamProcessorExtension7() throws InterruptedException {
logger.info("UpdateUpdateRegressionLearningStreamProcessorExtension TestCase "
+ "- Features are of un-supported type");
SiddhiManager siddhiManager = new SiddhiManager();
String inStreamDefinition = "define stream StreamA (attribute_0 double, attribute_1 double, attribute_2 "
+ "double, attribute_3 String, attribute_4 double );";
String query = ("@info(name = 'query1') from StreamA#streamingml:updateAMRulesRegressor('model1', "
+ "attribute_0, attribute_1 , attribute_2 ,attribute_3,attribute_4) select attribute_0, "
+ " attribute_1, attribute_2, attribute_3, meanSquaredError 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("model.features in 5th parameter is not "
+ "a numerical type attribute. Found STRING. Check the input stream definition."));
}
}
開發者ID:wso2-extensions,項目名稱:siddhi-gpl-execution-streamingml,代碼行數:23,代碼來源:AdaptiveModelRulesRegressorUpdaterStreamProcessorExtensionTestcase.java
示例6: testClusTree2D_6
import org.testng.AssertJUnit; //導入方法依賴的package包/類
@Test
public void testClusTree2D_6() throws Exception {
logger.info("ClusTreeStreamProcessorExtension Test - Test case to validate maxHeightOfTree to be constant");
SiddhiManager siddhiManager = new SiddhiManager();
String inputStream = "define stream InputStream (x double, y double, maxHeightOfTree int);";
String query = (
"@info(name = 'query1') " +
"from InputStream#streamingml:clusTree(2, 10, 20, maxHeightOfTree, 50, x, y) " +
"select closestCentroidCoordinate1, closestCentroidCoordinate2, x, y " +
"insert into OutputStream;");
try {
SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(inputStream + query);
} catch (Exception e) {
logger.info("Error caught");
AssertJUnit.assertTrue(e instanceof SiddhiAppCreationException);
AssertJUnit.assertTrue(e.getCause().getMessage().contains("maxHeightOfTree has to be a constant but " +
"found org.wso2.siddhi.core.executor.VariableExpressionExecutor"));
}
}
開發者ID:wso2-extensions,項目名稱:siddhi-gpl-execution-streamingml,代碼行數:21,代碼來源:ClusTreeStreamProcessorExtensionTest.java
示例7: testUpdateUpdateRegressionLearningStreamProcessorExtension3
import org.testng.AssertJUnit; //導入方法依賴的package包/類
@Test
public void testUpdateUpdateRegressionLearningStreamProcessorExtension3() throws InterruptedException {
logger.info("UpdateUpdateRegressionLearningStreamProcessorExtension TestCase "
+ "- Target value is not of type double");
SiddhiManager siddhiManager = new SiddhiManager();
String inStreamDefinition = "define stream StreamA (attribute_0 double, attribute_1 double, attribute_2 "
+ "double, attribute_3 double, attribute_4 String );";
String query = ("@info(name = 'query1') from StreamA#streamingml:updateAMRulesRegressor('model1', "
+ "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("model.features in 6th parameter is not a " +
"numerical type attribute. Found STRING. Check the input stream definition."));
}
}
開發者ID:wso2-extensions,項目名稱:siddhi-gpl-execution-streamingml,代碼行數:23,代碼來源:AdaptiveModelRulesRegressorUpdaterStreamProcessorExtensionTestcase.java
示例8: testClusTree2D_21
import org.testng.AssertJUnit; //導入方法依賴的package包/類
@Test
public void testClusTree2D_21() throws Exception {
logger.info("ClusTreeStreamProcessorExtension Test - Test case to validate maxHeightOfTree " +
"to be above a minimum value to produce required noOfClusters");
SiddhiManager siddhiManager = new SiddhiManager();
String inputStream = "define stream InputStream (x double, y double);";
String query = (
"@info(name = 'query1') " +
"from InputStream#streamingml:clusTree(20, 10, 20, 2, 50, x, y) " +
"select closestCentroidCoordinate1, closestCentroidCoordinate2, x, y " +
"insert into OutputStream;");
try {
SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(inputStream + query);
} catch (Exception e) {
logger.info("Error caught");
AssertJUnit.assertTrue(e instanceof SiddhiAppCreationException);
AssertJUnit.assertTrue(e.getCause().getMessage().contains("maxHeightOfTree should be an int greater " +
"than 2.7268 but found 2"));
}
}
開發者ID:wso2-extensions,項目名稱:siddhi-gpl-execution-streamingml,代碼行數:22,代碼來源:ClusTreeStreamProcessorExtensionTest.java
示例9: jsonSourceMapperTest21
import org.testng.AssertJUnit; //導入方法依賴的package包/類
@Test
public void jsonSourceMapperTest21() throws InterruptedException {
log.info("test JsonSourceMapper with test json object type");
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 Bool, price double, volume int); " +
"define stream BarStream (symbol Bool, price double, volume int); ";
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("Invalid JSON object received. Expected String"));
siddhiAppRuntime.shutdown();
}
示例10: testHoeffdingClassifierLearningExtension19
import org.testng.AssertJUnit; //導入方法依賴的package包/類
@Test
public void testHoeffdingClassifierLearningExtension19() throws InterruptedException {
logger.info("HoeffdingClassifierUpdaterStreamProcessorExtension TestCase " +
"- Configure a model with tie threshold value <0");
SiddhiManager siddhiManager = new SiddhiManager();
String inStreamDefinition = " define stream StreamA (attribute_0 double, attribute_1 double, attribute_2 "
+ "double,attribute_3 double, attribute_4 string );";
String query = ("@info(name = 'query1') "
+ "from StreamA#streamingml:updateHoeffdingTree('model1', 3, 5, 300, 1e-7, -2, false, false, 2, "
+ "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("Option tieThreshold cannot be less than 0.0,"
+ " out of range: -2.0"));
}
}
開發者ID:wso2-extensions,項目名稱:siddhi-gpl-execution-streamingml,代碼行數:23,代碼來源:HoeffdingClassifierUpdaterStreamProcessorExtensionTestCase.java
示例11: testClusTree2D_9
import org.testng.AssertJUnit; //導入方法依賴的package包/類
@Test
public void testClusTree2D_9() throws Exception {
logger.info("ClusTreeStreamProcessorExtension Test - Test case to validate attribute_0 to be variable");
SiddhiManager siddhiManager = new SiddhiManager();
String inputStream = "define stream InputStream (x double, y double);";
String query = (
"@info(name = 'query1') " +
"from InputStream#streamingml:clusTree(2, 10, 20, 5, 50, 8, y) " +
"select closestCentroidCoordinate1, closestCentroidCoordinate2, x, y " +
"insert into OutputStream;");
try {
SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(inputStream + query);
} catch (Exception e) {
logger.info("Error caught");
AssertJUnit.assertTrue(e instanceof SiddhiAppCreationException);
AssertJUnit.assertTrue(e.getCause().getMessage().contains("6th parameter is not an attribute " +
"(VariableExpressionExecutor) present in the stream definition. Found a " +
"org.wso2.siddhi.core.executor.ConstantExpressionExecutor"));
}
}
開發者ID:wso2-extensions,項目名稱:siddhi-gpl-execution-streamingml,代碼行數:22,代碼來源:ClusTreeStreamProcessorExtensionTest.java
示例12: testDurationAndCalendar1
import org.testng.AssertJUnit; //導入方法依賴的package包/類
@Test
public void testDurationAndCalendar1() {
int year = 1;
int month = 2;
int day = 3;
int hour = 4;
int min = 5;
int sec = 6;
String lexicalRepresentation = "P" + year + "Y" + month + "M" + day + "DT" + hour + "H" + min + "M" + sec + "S";
try {
Duration dur = DatatypeFactory.newInstance().newDuration(lexicalRepresentation);
System.out.println(dur.toString());
AssertJUnit.assertTrue("year should be 1", dur.getYears() == year);
AssertJUnit.assertTrue("month should be 2", dur.getMonths() == month);
AssertJUnit.assertTrue("day should be 3", dur.getDays() == day);
AssertJUnit.assertTrue("hour should be 4", dur.getHours() == hour);
AssertJUnit.assertTrue("minute should be 5", dur.getMinutes() == min);
AssertJUnit.assertTrue("second should be 6", dur.getSeconds() == sec);
} catch (DatatypeConfigurationException e) {
e.printStackTrace();
}
}
示例13: isDisplayed
import org.testng.AssertJUnit; //導入方法依賴的package包/類
public void isDisplayed() throws Throwable {
AssertJUnit.assertTrue(ejButton.isDisplayed());
SwingUtilities.invokeAndWait(new Runnable() {
@Override public void run() {
button.setVisible(false);
}
});
AssertJUnit.assertFalse(ejButton.isDisplayed());
}
示例14: testSelectAdjacentEntitiesWithNullRelationshipNameAndValidDirection
import org.testng.AssertJUnit; //導入方法依賴的package包/類
@Test
public void testSelectAdjacentEntitiesWithNullRelationshipNameAndValidDirection() {
GraphVisitor repository = new MockGraphVisitor();
GraphQueryImpl graphQueryImpl = new GraphQueryImpl(repository);
Direction direction = Direction.IN_OUT;
try {
graphQueryImpl.selectAdjacentEntitiesVia(null, direction);
Assert.fail("Should have thrown an exception for null name");
} catch (Exception e) {
AssertJUnit.assertTrue(e instanceof IllegalArgumentException);
AssertJUnit.assertEquals(e.getMessage(), "Parameter \"name::com.intuit.ugc.api.Relationship$Name\" cannot be null");
}
}
示例15: checkGivenExecutableIsUsed
import org.testng.AssertJUnit; //導入方法依賴的package包/類
public void checkGivenExecutableIsUsed() throws Throwable {
JavaProfile profile = new JavaProfile(LaunchMode.JAVA_APPLET);
File f = findFile();
profile.setAppletURL(f.getAbsolutePath());
profile.setStartWindowTitle("Applet Viewer: SwingSet3Init.class");
String actual = "";
if (OS.isFamilyWindows()) {
String path = System.getenv("Path");
String[] split = path.split(";");
File file = new File(split[0]);
File[] listFiles = file.listFiles();
if (listFiles != null) {
for (File listFile : listFiles) {
if (listFile.getName().contains(".exe")) {
profile.setJavaCommand(listFile.getAbsolutePath());
actual = listFile.getAbsolutePath();
break;
}
}
}
} else {
actual = "ls";
profile.setJavaCommand(actual);
}
CommandLine commandLine = profile.getCommandLine();
AssertJUnit.assertTrue(commandLine.toString().contains(actual));
}