Java Code Examples for org.testng.AssertJUnit#assertNotNull()
The following examples show how to use
org.testng.AssertJUnit#assertNotNull() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JdbcRegressionUnitTest.java From cassandra-jdbc-wrapper with Apache License 2.0 | 6 votes |
@Test public void testIssue75() throws Exception { System.out.println(); System.out.println("Test Issue #75"); System.out.println("--------------"); Statement stmt = con.createStatement(); String truncate = "TRUNCATE regressiontest;"; stmt.execute(truncate); String select = "select ivalue from "+TABLE; ResultSet result = stmt.executeQuery(select); AssertJUnit.assertFalse("Make sure we have no rows", result.next()); ResultSetMetaData rsmd = result.getMetaData(); AssertJUnit.assertTrue("Make sure we do get a result", rsmd.getColumnDisplaySize(1) != 0); AssertJUnit.assertNotNull("Make sure we do get a label",rsmd.getColumnLabel(1)); System.out.println("Found a column in ResultsetMetaData even when there are no rows: " + rsmd.getColumnLabel(1)); stmt.close(); }
Example 2
Source File: SimpleQueryTestCase.java From siddhi with Apache License 2.0 | 6 votes |
@Test public void test2() throws SiddhiParserException { Query query = SiddhiCompiler.parseQuery("from StockStream [price >= 20]#window.lengthBatch(50) " + "select symbol, avg(price) as avgPrice " + "group by symbol " + "having avgPrice>50 " + "insert into StockQuote; " ); AssertJUnit.assertNotNull(query); Query api = Query.query().from(InputStream.stream("StockStream"). filter(Expression.compare(Expression.variable("price"), Compare.Operator.GREATER_THAN_EQUAL, Expression.value(20))). window("lengthBatch", Expression.value(50))). select(Selector.selector(). select(Expression.variable("symbol")). select("avgPrice", Expression.function("avg", Expression.variable("price"))). groupBy(Expression.variable("symbol")). having(Expression.compare( Expression.variable("avgPrice"), Compare.Operator.GREATER_THAN, Expression.value(50)))). insertInto("StockQuote"); AssertJUnit.assertEquals(api, query); }
Example 3
Source File: JavaProfileTest.java From marathonv5 with Apache License 2.0 | 6 votes |
public void executeWSCommand() throws Throwable { if (OS.isFamilyWindows()) { throw new SkipException("Test not valid for Windows"); } JavaProfile profile = new JavaProfile(LaunchMode.JAVA_WEBSTART).addWSArgument("-verbose").addVMArgument("-Dx.y.z=hello"); final CommandLine commandLine = profile.getCommandLine(); AssertJUnit.assertNotNull(commandLine); AssertJUnit.assertTrue(commandLine.toString().contains("-javaagent:")); AssertJUnit.assertTrue(commandLine.toString().contains("-verbose")); AssertJUnit.assertTrue(commandLine.toString().contains("-Dx.y.z=hello")); ByteArrayOutputStream baos = new ByteArrayOutputStream(); commandLine.copyOutputTo(baos); commandLine.executeAsync(); new Wait("Waiting till the command is complete") { @Override public boolean until() { return !commandLine.isRunning(); } }; BufferedReader reader = new BufferedReader(new StringReader(new String(baos.toByteArray()))); String line = reader.readLine(); while (line != null && !line.contains("Web Start")) { line = reader.readLine(); } AssertJUnit.assertTrue(line.contains("Web Start")); }
Example 4
Source File: SimpleQueryTestCase.java From siddhi with Apache License 2.0 | 6 votes |
@Test public void test1() throws SiddhiParserException { Query query = SiddhiCompiler.parseQuery("from StockStream[price>3]#window.length(50) " + "select symbol, avg(price) as avgPrice " + "group by symbol " + "having (price >= 20) " + "insert all events into StockQuote; " ); AssertJUnit.assertNotNull(query); Query api = Query.query().from(InputStream.stream("StockStream"). filter(Expression.compare(Expression.variable("price"), Compare.Operator.GREATER_THAN, Expression .value(3))). window("length", Expression.value(50))). select(Selector.selector().select(Expression.variable("symbol")). select("avgPrice", Expression.function("avg", Expression.variable("price"))). groupBy(Expression.variable("symbol")). having(Expression.compare( Expression.variable("price"), Compare.Operator.GREATER_THAN_EQUAL, Expression.value(20)))). insertInto("StockQuote", OutputStream.OutputEventType.ALL_EVENTS); AssertJUnit.assertEquals(api, query); }
Example 5
Source File: JavaDriverTest.java From marathonv5 with Apache License 2.0 | 6 votes |
public void windowSize() throws Throwable { driver = new JavaDriver(); SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { frame.setLocationRelativeTo(null); frame.setVisible(true); } }); Window window = driver.manage().window(); Dimension actual = window.getSize(); AssertJUnit.assertNotNull(actual); java.awt.Dimension expected = EventQueueWait.call(frame, "getSize"); AssertJUnit.assertEquals(expected.width, actual.width); AssertJUnit.assertEquals(expected.height, actual.height); }
Example 6
Source File: JavaDriverTest.java From marathonv5 with Apache License 2.0 | 5 votes |
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); }
Example 7
Source File: FindByCssSelectorTest.java From marathonv5 with Apache License 2.0 | 5 votes |
public void adjecentSiblingForElement() throws Throwable { IJavaElement box = driver.findElementByCssSelector("#box-panel"); AssertJUnit.assertNotNull(box); List<IJavaElement> elements = box.findElementsByCssSelector("button"); AssertJUnit.assertEquals(2, elements.size()); elements = box.findElementsByCssSelector("button + check-box"); AssertJUnit.assertEquals(1, elements.size()); elements = box.findElementsByCssSelector("text-field + button"); AssertJUnit.assertEquals(1, elements.size()); elements = box.findElementsByCssSelector("text-field + check-box"); AssertJUnit.assertEquals(0, elements.size()); }
Example 8
Source File: SimpleQueryTestCase.java From siddhi with Apache License 2.0 | 5 votes |
@Test(expectedExceptions = UnsupportedAttributeTypeException.class) public void test19() throws SiddhiParserException { Query query = SiddhiCompiler.parseQuery("from StockStream[price>3]#window.length(50) " + "select symbol, avg(price) as avgPrice " + "group by symbol " + "having (price >= 20)" + "order by avgPrice desc " + "limit 5 " + "offset 3 " + "insert all events into StockQuote; " ); AssertJUnit.assertNotNull(query); Query api = Query.query().from(InputStream.stream("StockStream"). filter(Expression.compare(Expression.variable("price"), Compare.Operator.GREATER_THAN, Expression .value(3))). window("length", Expression.value(50))). select(Selector.selector().select(Expression.variable("symbol")). select("avgPrice", Expression.function("avg", Expression.variable("price"))). groupBy(Expression.variable("symbol")). having(Expression.compare( Expression.variable("price"), Compare.Operator.GREATER_THAN_EQUAL, Expression.value(20))). orderBy(Expression.variable("avgPrice"), OrderByAttribute.Order.DESC). limit(Expression.value(5)). offset(Expression.value(3.8))). insertInto("StockQuote", OutputStream.OutputEventType.ALL_EVENTS); }
Example 9
Source File: SimpleQueryTestCase.java From siddhi with Apache License 2.0 | 5 votes |
@Test public void test15() { Query queryString = SiddhiCompiler.parseQuery("" + "from StockStream[7+9.5 > price and 100 >= volume]#window.length(50) " + " " + "select symbol as symbol, price as price, volume as volume " + "update StockQuote \n " + " on symbol==StockQuote.symbol ;" ); AssertJUnit.assertNotNull(queryString); Query query = Query.query(); query.from( InputStream.stream("StockStream"). filter(Expression.and(Expression.compare(Expression.add(Expression.value(7), Expression.value (9.5)), Compare.Operator.GREATER_THAN, Expression.variable("price")), Expression.compare(Expression.value(100), Compare.Operator.GREATER_THAN_EQUAL, Expression.variable("volume") ) ) ).window("length", Expression.value(50)) ); query.select( Selector.selector(). select("symbol", Expression.variable("symbol")). select("price", Expression.variable("price")). select("volume", Expression.variable("volume")) ); query.updateBy("StockQuote", OutputStream.OutputEventType.CURRENT_EVENTS, Expression.compare( Expression.variable("symbol"), Compare.Operator.EQUAL, Expression.variable("symbol").ofStream("StockQuote"))); AssertJUnit.assertEquals(query, queryString); }
Example 10
Source File: SimpleQueryTestCase.java From siddhi with Apache License 2.0 | 5 votes |
@Test public void test12() throws SiddhiParserException { Query query = SiddhiCompiler.parseQuery("from StockStream[price>3]#window.length(50) " + "select symbol, avg(price) as avgPrice " + "group by symbol " + "having (price >= 20)" + "order by avgPrice desc " + "limit 5 " + "insert all events into StockQuote; " ); AssertJUnit.assertNotNull(query); Query api = Query.query().from(InputStream.stream("StockStream"). filter(Expression.compare(Expression.variable("price"), Compare.Operator.GREATER_THAN, Expression .value(3))). window("length", Expression.value(50))). select(Selector.selector().select(Expression.variable("symbol")). select("avgPrice", Expression.function("avg", Expression.variable("price"))). groupBy(Expression.variable("symbol")). having(Expression.compare( Expression.variable("price"), Compare.Operator.GREATER_THAN_EQUAL, Expression.value(20))). orderBy(Expression.variable("avgPrice"), OrderByAttribute.Order.DESC). limit(Expression.value(5))). insertInto("StockQuote", OutputStream.OutputEventType.ALL_EVENTS); AssertJUnit.assertEquals(api, query); }
Example 11
Source File: JavaProfileTest.java From marathonv5 with Apache License 2.0 | 5 votes |
public void getWsCommandWithJNLP() throws Throwable { JavaProfile profile = new JavaProfile(LaunchMode.JAVA_WEBSTART).addWSArgument("-verbose").addVMArgument("-Dx.y.z=hello"); profile.setJNLPPath(new File("SwingSet3.jnlp").getAbsolutePath()); final CommandLine commandLine = profile.getCommandLine(); AssertJUnit.assertNotNull(commandLine); AssertJUnit.assertTrue(commandLine.toString().contains("-javaagent:")); AssertJUnit.assertTrue(commandLine.toString().contains("-verbose")); AssertJUnit.assertTrue(commandLine.toString().contains("-Dx.y.z=hello")); AssertJUnit.assertTrue(commandLine.toString().contains("SwingSet3.jnlp")); }
Example 12
Source File: FindByCssSelectorTest.java From marathonv5 with Apache License 2.0 | 4 votes |
public void descendentSelector() throws Throwable { IJavaElement element = driver.findElementByCssSelector("box button:enabled"); AssertJUnit.assertNotNull(element); AssertJUnit.assertEquals(EventQueueWait.call(button, "getName"), element.getAttribute("name")); }
Example 13
Source File: SelectorParserTest.java From marathonv5 with Apache License 2.0 | 4 votes |
public void parseSelectorGeneralSibling() throws Throwable { SelectorParser parser = new SelectorParser("menu ~ menu-item"); Selector selector = parser.parse(); AssertJUnit.assertNotNull(selector); AssertJUnit.assertEquals("menu ~ menu-item", selector.toString()); }
Example 14
Source File: SimpleQueryTestCase.java From siddhi with Apache License 2.0 | 4 votes |
@Test public void test10() { Query queryString = SiddhiCompiler.parseQuery("" + "from StockStream[7+9.5 > price and 100 >= volume]#window.length(50) " + " " + "select symbol as symbol, price as price, volume as volume " + "update StockQuote \n " + " set StockQuote.price = price, \n " + " StockQuote.volume = volume " + " on symbol==StockQuote.symbol ;" ); AssertJUnit.assertNotNull(queryString); Query query = Query.query(); query.from( InputStream.stream("StockStream"). filter(Expression.and(Expression.compare(Expression.add(Expression.value(7), Expression.value (9.5)), Compare.Operator.GREATER_THAN, Expression.variable("price")), Expression.compare(Expression.value(100), Compare.Operator.GREATER_THAN_EQUAL, Expression.variable("volume") ) ) ).window("length", Expression.value(50)) ); query.select( Selector.selector(). select("symbol", Expression.variable("symbol")). select("price", Expression.variable("price")). select("volume", Expression.variable("volume")) ); query.updateBy("StockQuote", OutputStream.OutputEventType.CURRENT_EVENTS, UpdateStream.updateSet(). set( Expression.variable("price").ofStream("StockQuote"), Expression.variable("price")). set( Expression.variable("volume").ofStream("StockQuote"), Expression.variable("volume")), Expression.compare( Expression.variable("symbol"), Compare.Operator.EQUAL, Expression.variable("symbol").ofStream("StockQuote"))); AssertJUnit.assertEquals(query, queryString); }
Example 15
Source File: SelectorParserTest.java From marathonv5 with Apache License 2.0 | 4 votes |
public void parseTagWithNumberArgs() throws Throwable { SelectorParser parser = new SelectorParser("menu:has-size(50, 60.9)"); Selector selector = parser.parse(); AssertJUnit.assertNotNull(selector); AssertJUnit.assertEquals("menu:has-size(50, 60.9)", selector.toString()); }
Example 16
Source File: RandomTipOfTheDayModelTest.java From otroslogviewer with Apache License 2.0 | 4 votes |
@Test public void testGetTipAtNotNull() { for (int i = 0; i < tipsModel.getTipCount(); i++) { AssertJUnit.assertNotNull(tipsModel.getTipAt(i)); } }
Example 17
Source File: SimpleQueryTestCase.java From siddhi with Apache License 2.0 | 4 votes |
@Test public void test16() { Query queryString = SiddhiCompiler.parseQuery("" + "from StockStream[7+9.5 > price and 100 >= volume]#window.length(50) " + " " + "select symbol as symbol, price as price, volume as volume " + "update or insert into StockQuote \n " + " set StockQuote.price = price, \n " + " StockQuote.volume = volume " + " on symbol==StockQuote.symbol ;" ); AssertJUnit.assertNotNull(queryString); Query query = Query.query(); query.from( InputStream.stream("StockStream"). filter(Expression.and(Expression.compare(Expression.add(Expression.value(7), Expression.value (9.5)), Compare.Operator.GREATER_THAN, Expression.variable("price")), Expression.compare(Expression.value(100), Compare.Operator.GREATER_THAN_EQUAL, Expression.variable("volume") ) ) ).window("length", Expression.value(50)) ); query.select( Selector.selector(). select("symbol", Expression.variable("symbol")). select("price", Expression.variable("price")). select("volume", Expression.variable("volume")) ); query.updateOrInsertBy("StockQuote", OutputStream.OutputEventType.CURRENT_EVENTS, UpdateStream.updateSet(). set( Expression.variable("price").ofStream("StockQuote"), Expression.variable("price")). set( Expression.variable("volume").ofStream("StockQuote"), Expression.variable("volume")), Expression.compare( Expression.variable("symbol"), Compare.Operator.EQUAL, Expression.variable("symbol").ofStream("StockQuote"))); AssertJUnit.assertEquals(query, queryString); }
Example 18
Source File: SelectorParserTest.java From marathonv5 with Apache License 2.0 | 4 votes |
public void parseTag() throws Throwable { SelectorParser parser = new SelectorParser("menu"); Selector selector = parser.parse(); AssertJUnit.assertNotNull(selector); AssertJUnit.assertEquals("menu", selector.toString()); }
Example 19
Source File: JavaElementTest.java From marathonv5 with Apache License 2.0 | 4 votes |
public void findElement() throws Throwable { IJavaElement e = ejBoxPanel.findElementByName("click-me"); AssertJUnit.assertNotNull(e); }
Example 20
Source File: FindByCssSelectorTest.java From marathonv5 with Apache License 2.0 | 4 votes |
public void universalSelectorWithTag() throws Throwable { IJavaElement element = driver.findElementByCssSelector("#click-me"); AssertJUnit.assertNotNull(element); AssertJUnit.assertEquals(EventQueueWait.call(button, "getName"), element.getAttribute("name")); }