List of usage examples for junit.framework Assert assertNotNull
static public void assertNotNull(Object object)
From source file:net.i2cat.netconf.test.TransportContentparserTest.java
@Test public void parseUnknownReply() throws IOException, SAXException { parseMessage(buildLLDPNeighborsInformationReply()); RPCElement rpcElement = queue.consume(); Assert.assertNotNull(rpcElement); Assert.assertTrue(rpcElement instanceof Reply); Reply reply = (Reply) rpcElement;// w w w . j a va 2 s . c om Assert.assertEquals("Contain must be 'lldp-neighbors-information'", "lldp-neighbors-information", reply.getContainName()); Assert.assertNotNull("Contain must not be null", reply.getContain()); log.info(reply.getContain()); }
From source file:com.projity.exchange.MicrosoftImporterTest.java
@Test public void testXMLImport() throws Exception { LoadOptions opts = new LoadOptions(); opts.setLocal(true);/*from ww w .ja va2s. c om*/ opts.setSync(true); opts.setLocal(true); opts.setImporter(LocalSession.MICROSOFT_PROJECT_IMPORTER); opts.setFileName(xmlFileName); Project project = pf.openProject(opts); Assert.assertNotNull(project); }
From source file:alpha.portal.webapp.filter.LocaleFilterTest.java
/** * Test jstl locale is set./*from w w w . jav a2 s .c om*/ * * @throws Exception * the exception */ public void testJstlLocaleIsSet() throws Exception { final MockHttpServletRequest request = new MockHttpServletRequest(); request.addParameter("locale", "es"); final MockHttpServletResponse response = new MockHttpServletResponse(); request.setSession(new MockHttpSession(null)); this.filter.doFilter(request, response, new MockFilterChain()); Assert.assertNotNull(Config.get(request.getSession(), Config.FMT_LOCALE)); }
From source file:BQJDBC.QueryResultTest.Timeouttest.java
@Test public void QueryResultTest01() { final String sql = "SELECT TOP(word, 10), COUNT(*) FROM publicdata:samples.shakespeare"; final String description = "The top 10 word from shakespeare #TOP #COUNT"; String[][] expectation = new String[][] { { "you", "yet", "would", "world", "without", "with", "your", "young", "words", "word" }, { "42", "42", "42", "42", "42", "42", "41", "41", "41", "41" } }; /** somehow the result changed with time { "you", "yet", "would", "world", "without", "with", "will", "why", "whose", "whom" },//from w w w.j a va 2 s .c o m { "42", "42", "42", "42", "42", "42", "42", "42", "42", "42" } }; */ this.logger.info("Test number: 01"); this.logger.info("Running query:" + sql); java.sql.ResultSet Result = null; try { Result = Timeouttest.con.createStatement().executeQuery(sql); } catch (SQLException e) { this.logger.error("SQLexception" + e.toString()); Assert.fail("SQLException" + e.toString()); } Assert.assertNotNull(Result); this.logger.debug(description); HelperFunctions.printer(expectation); try { Assert.assertTrue("Comparing failed in the String[][] array", this.comparer(expectation, BQSupportMethods.GetQueryResult(Result))); } catch (SQLException e) { this.logger.error("SQLexception" + e.toString()); Assert.fail(e.toString()); } }
From source file:org.sakaiproject.iclicker.dao.IClickerDaoImplTest.java
/** * Test method for//from www . jav a2 s .co m * {@link org.sakaiproject.iclicker.dao.impl.GenericHibernateDao#findById(java.lang.Class, java.io.Serializable)} * . */ public void testFindById() { Long id = item.getId(); Assert.assertNotNull(id); ClickerRegistration item1 = (ClickerRegistration) dao.findById(ClickerRegistration.class, id); Assert.assertNotNull(item1); Assert.assertEquals(item, item1); }
From source file:com.hybris.instore.widgets.listtracker.ListTrackerControllerTest.java
@Test public void testActivateNext() { final Integer activeIndex = controller.getValue(ListTrackerController.MODEL_ACTIVE_INDEX, Integer.class); controller.activateNext();//ww w . jav a 2s .c o m final Integer newIndex = controller.getValue(ListTrackerController.MODEL_ACTIVE_INDEX, Integer.class); Assert.assertNotNull(activeIndex); Assert.assertNotNull(newIndex); Assert.assertTrue((activeIndex.intValue() + 1) == newIndex.intValue()); // make sure 'next' is disabled when there are no more elements in list controller.setActiveIndex(Integer.valueOf(9)); Assert.assertTrue(Integer.valueOf(9) .equals(controller.getValue(ListTrackerController.MODEL_ACTIVE_INDEX, Integer.class))); controller.activateNext(); Assert.assertTrue(Integer.valueOf(9) .equals(controller.getValue(ListTrackerController.MODEL_ACTIVE_INDEX, Integer.class))); }
From source file:org.netxilia.spi.impl.formula.TestCellCommands.java
@Test public void testPasteNoCell() throws NetxiliaResourceException, NetxiliaBusinessException { ISheet sheet = SheetUtils.sheetWithCell(); String[][] data = { { "=B1 + 10", "100" }, { "true", "=$B$2 + 100" } }; sheet.sendCommand(cellCommands.paste(new AreaReference("C2:D3"), data, null)); CellData newDataC2 = sheet.receiveCell(new CellReference("C2")).getNonBlocking(); Assert.assertNotNull(newDataC2); Assert.assertEquals(new Formula("=B1 + 10"), newDataC2.getFormula()); CellData newDataC3 = sheet.receiveCell(new CellReference("C3")).getNonBlocking(); Assert.assertNotNull(newDataC3);// w w w .ja v a2s . c om Assert.assertEquals(true, newDataC3.getValue().getBooleanValue().booleanValue()); CellData newDataD2 = sheet.receiveCell(new CellReference("D2")).getNonBlocking(); Assert.assertNotNull(newDataD2); Assert.assertEquals(100.0, newDataD2.getValue().getNumberValue()); CellData newDataD3 = sheet.receiveCell(new CellReference("D3")).getNonBlocking(); Assert.assertNotNull(newDataD3); Assert.assertEquals(new Formula("=$B$2 + 100"), newDataD3.getFormula()); }
From source file:org.openxdata.server.service.impl.ReportServiceTest.java
@Test public void saveReportGroup_shouldSaveReportAndGroup() throws Exception { final String groupName = "New Report Group"; final String reportName = "New Report"; List<ReportGroup> reportGroups = reportsService.getReportGroups(); Assert.assertEquals(1, reportGroups.size()); Assert.assertNull(ReportGroup.getReport(reportName, reportGroups)); Assert.assertNull(getReportGroup(groupName, reportGroups)); ReportGroup reportGroup = new ReportGroup(groupName); reportGroup.setCreator(userService.getUsers().get(0)); reportGroup.setDateCreated(new Date()); Report report = new Report(reportName); report.setCreator(userService.getUsers().get(0)); report.setDateCreated(new Date()); report.setReportGroup(reportGroup);//from w w w . j av a 2s. c o m reportGroup.addReport(report); reportsService.saveReportGroup(reportGroup); reportGroups = reportsService.getReportGroups(); Assert.assertEquals(2, reportGroups.size()); reportGroup = getReportGroup(groupName, reportGroups); Assert.assertNotNull(reportGroup); Assert.assertEquals(1, reportGroup.getReports().size()); Assert.assertEquals(groupName, reportGroup.getName()); report = ReportGroup.getReport(reportName, reportGroups); Assert.assertNotNull(report); }
From source file:io.cloudslang.lang.runtime.steps.ExecutableStepsTest.java
@Test public void testBoundInputEvent() { List<Input> inputs = Arrays.asList(new Input.InputBuilder("input1", "input1").build(), new Input.InputBuilder("input2", "3").withEncrypted(true).withRequired(true).withOverridable(false) .build());/*from w ww . j a v a2 s. c o m*/ RunEnvironment runEnv = new RunEnvironment(); ExecutionRuntimeServices runtimeServices = new ExecutionRuntimeServices(); Map<String, Serializable> resultMap = new HashMap<>(); resultMap.put("input1", 5); resultMap.put("input2", 3); when(inputsBinding.bindInputs(eq(inputs), anyMap(), anySet())).thenReturn(resultMap); executableSteps.startExecutable(inputs, runEnv, new HashMap<String, Serializable>(), runtimeServices, "dockerizeStep", 2L); Collection<ScoreEvent> events = runtimeServices.getEvents(); Assert.assertFalse(events.isEmpty()); ScoreEvent boundInputEvent = null; for (ScoreEvent event : events) { if (event.getEventType().equals(ScoreLangConstants.EVENT_INPUT_END)) { boundInputEvent = event; } } Assert.assertNotNull(boundInputEvent); LanguageEventData eventData = (LanguageEventData) boundInputEvent.getData(); Assert.assertTrue(eventData.containsKey(LanguageEventData.BOUND_INPUTS)); Map<String, Serializable> inputsBounded = (Map<String, Serializable>) eventData .get(LanguageEventData.BOUND_INPUTS); Assert.assertNotNull(eventData.getStepName()); Assert.assertEquals(LanguageEventData.StepType.EXECUTABLE, eventData.getStepType()); Assert.assertEquals("dockerizeStep", eventData.getStepName()); // verify input names are in defined order and have the expected value Set<Map.Entry<String, Serializable>> inputEntries = inputsBounded.entrySet(); Iterator<Map.Entry<String, Serializable>> inputNamesIterator = inputEntries.iterator(); Map.Entry<String, Serializable> firstInput = inputNamesIterator.next(); org.junit.Assert.assertEquals("Inputs are not in defined order in end inputs binding event", "input1", firstInput.getKey()); org.junit.Assert.assertEquals(5, firstInput.getValue()); Map.Entry<String, Serializable> secondInput = inputNamesIterator.next(); org.junit.Assert.assertEquals("Inputs are not in defined order in end inputs binding event", "input2", secondInput.getKey()); org.junit.Assert.assertEquals(LanguageEventData.ENCRYPTED_VALUE, secondInput.getValue()); }
From source file:io.cloudslang.lang.compiler.PreCompileTransformersTest.java
@Test public void testPropertiesOnStepPublishOutput() throws Exception { URI flow = getClass().getResource("/check_weather_flow_sensitive.sl").toURI(); ExecutableModellingResult result = compiler.preCompileSource(SlangSource.fromFile(flow)); List<RuntimeException> errors = result.getErrors(); Assert.assertNotNull(errors); Assert.assertTrue(errors.size() > 0); exception.expect(RuntimeException.class); exception.expectMessage("It is illegal to specify properties for step publish outputs."); exception.expectMessage("Please remove the properties for flow_output_1."); throw errors.get(0); }