List of usage examples for junit.framework Assert assertNotNull
static public void assertNotNull(Object object)
From source file:de.akquinet.gomobile.androlog.test.MailReporterTest.java
public void testMailWithLongLog() { Log.init(getContext());/*from ww w .j a va2 s . co m*/ String message = "This is a INFO test"; String tag = "my.log.info"; Log.d(tag, message); Log.i(tag, message); Log.w(tag, message); for (int i = 0; i < 200; i++) { Log.w("" + i); } List<String> list = Log.getReportedEntries(); Assert.assertNotNull(list); Assert.assertFalse(list.isEmpty()); Assert.assertEquals(25, list.size()); Log.report(); Log.report("this is a user message", null); Exception error = new MalformedChallengeException("error message", new NumberFormatException()); Log.report(null, error); }
From source file:org.businessmanager.service.ContactServiceTest.java
@Test public void testGetVCard() { Contact contact = new Contact("Bruce", "Wayne"); contact.setBirthday(Calendar.getInstance()); contact.setCompany("Wayne Enterprises"); contact.setJobTitle("CEO"); contact.setNotes("Batcave Notes"); Address address = new Address(); address.setCity("Gotham City"); address.setCountry("us"); address.setScope(AddressType.BILLING); address.setStreet("Mountain Drive"); address.setHousenumber("1007"); address.setZipCode("10286"); contact.getAddresses().add(address); OutputStream out = contactService.getAsVCard(contact); Assert.assertNotNull(out); System.out.println(out);//from w w w . java 2s. c o m }
From source file:com.idtmatter.insta4j.client.FullInstaClientTest.java
@Test(expected = InvalidCredentialsException.class) public void authorizeWithWrongPasswordTest() throws FailedLoginException { final FullInstaClient client = FullInstaClient.create("jinstapaper@gmail.com", "open"); final Map<String, String> authorize = client.authorize("jinstapaper@gmail.com", "ooloo"); Assert.assertNotNull(authorize); Assert.assertNotNull(authorize.get("oauth_token")); Assert.assertNotNull(authorize.get("oauth_token_secret")); }
From source file:org.netxilia.spi.impl.formula.TestFindAndFilter.java
@Test public void testFilterValue() throws NetxiliaResourceException, NetxiliaBusinessException { ISheet sheet = SheetUtils.sheetWithCell("A1", 200, "A2", "200", "A3", 200.0); List<Integer> rows = operations.filter(sheet, new Formula("=A1=200")).getNonBlocking(); Assert.assertNotNull(rows); Assert.assertEquals(rows.size(), 2); Assert.assertEquals(0, rows.get(0).intValue()); Assert.assertEquals(2, rows.get(1).intValue()); }
From source file:com.yahoo.storm.yarn.TestStormMaster.java
@Test public void test1() throws Exception { StormMaster.Client master_client = client.getClient(); LOG.info("getStormConf"); Assert.assertNotNull(master_client.getStormConf()); LOG.info("addSupervisors(1)"); master_client.addSupervisors(1);/*from w w w . j a va 2 s .co m*/ }
From source file:io.cloudslang.engine.queue.repositories.ExecutionQueueRepositoryTest.java
@Test public void testPollMessagesWithoutAckWithVersion() { List<ExecutionMessage> msg = new ArrayList<>(); msg.add(generateMessage(1, "group1", "msg1", 1)); executionQueueRepository.insertExecutionQueue(msg, 1L); msg.clear();/* w w w .j a v a 2s. c om*/ msg.add(generateMessage(2, "group2", "msg2", 1)); executionQueueRepository.insertExecutionQueue(msg, 4L); List<ExecutionMessage> result = executionQueueRepository.pollMessagesWithoutAck(100, 3); Assert.assertNotNull(result); Assert.assertEquals(1, result.size()); ExecutionMessage resultMsg = result.get(0); Assert.assertEquals(ExecStatus.SENT, resultMsg.getStatus()); Assert.assertEquals("group1", resultMsg.getWorkerGroup()); }
From source file:org.openmrs.module.webservices.rest.web.v1_0.controller.ConceptDescriptionControllerTest.java
/** * @See {@link ConceptDescriptionResource#getByUniqueId(String)} * @throws Exception/* w w w .j a va2 s . c o m*/ */ @Test public void shouldGetAConceptDescriptionWhenRepresentationIsSetToFull() throws Exception { request.addParameter(RestConstants.REQUEST_PROPERTY_FOR_REPRESENTATION, RestConstants.REPRESENTATION_FULL); Object result = controller.retrieve(conceptUuid, descriptionUuid, request); Assert.assertNotNull(result); Assert.assertNotNull(PropertyUtils.getProperty(result, "uuid")); Assert.assertEquals("Affirmative", PropertyUtils.getProperty(result, "description")); Assert.assertEquals("en", PropertyUtils.getProperty(result, "locale")); Assert.assertNotNull(PropertyUtils.getProperty(result, "auditInfo")); }
From source file:com.opensourceagility.springintegration.alerts.AlertsIntegrationTest.java
@SuppressWarnings("unchecked") @Test/*from ww w . ja va 2s . c o m*/ public void testChannelAdapterDemo() throws InterruptedException, ParseException { System.setProperty("spring.profiles.active", "testCase"); final GenericXmlApplicationContext applicationContext = new GenericXmlApplicationContext( configFilesChannelAdapterDemo); final MessageChannel createAlertRequestChannel = applicationContext.getBean("createAlertRequestChannel", MessageChannel.class); createAlertTestData(createAlertRequestChannel, thisMinuteDate); final QueueChannel queueChannel = applicationContext.getBean("queueChannel", QueueChannel.class); for (int counter = 1; counter <= 50; counter++) { int id = counter * 2; Message<String> reply = (Message<String>) queueChannel.receive(10000); Assert.assertNotNull(reply); String out = reply.getPayload(); Assert.assertEquals(getExpectedXml(id), out); LOGGER.debug("Received expected Alert XML from queue:" + out); } LOGGER.debug( "Asserted that urgent alerts are those 50 alerts with even ids, ranging from 2 up to 100... and that these are received from the queue"); Message<String> reply = (Message<String>) queueChannel.receive(10000); Assert.assertNull(reply); LOGGER.debug("Sleeping for 2 minutes until files are expected to have been (mock) uploaded..."); Thread.sleep(120 * 1000); final MockAmazonS3FileUploader mockFileProcessor = applicationContext.getBean("amazonS3FileUploader", MockAmazonS3FileUploader.class); Assert.assertEquals(2, mockFileProcessor.getLinesByFileName().size()); LOGGER.debug("Asserted successfully that 2 csv files were expected"); List<String> minute1Lines = mockFileProcessor.getLinesByFileName().get(thisMinuteString); List<String> minute2Lines = mockFileProcessor.getLinesByFileName().get(nextMinuteString); // Assert we have the correct 30 entries in the csv file for the 1st minute Assert.assertEquals(30, minute1Lines.size()); LOGGER.debug("Asserted successfully that 30 alerts found in file:" + thisMinuteString); // Assert we have 20 correct entries in the csv file for the 2nd minute Assert.assertEquals(20, minute2Lines.size()); LOGGER.debug("Asserted successfully that 20 alerts found in file:" + nextMinuteString); // Check that the 1st minute's csv lines are as expected for (int counter = 1; counter <= 30; counter++) { int id = counter * 2 - 1; String line = minute1Lines.get(counter - 1); Assert.assertEquals(getExpectedCsvLine(id), line); LOGGER.debug("Found expected csv line in file:" + thisMinuteString + ":" + line); } // Check that the 2nd minute's csv lines are as expected for (int counter = 31; counter <= 50; counter++) { int id = counter * 2 - 1; String line = minute2Lines.get(counter - 31); Assert.assertEquals(getExpectedCsvLine(id), line); LOGGER.debug("Found expected csv line in file:" + nextMinuteString + " : " + line); } LOGGER.debug( "Asserted that non-urgent alerts are those 50 alerts with odd ids, ranging from 1 up to 99... and that these are written to csv files and uploaded"); LOGGER.debug("Completed test successfully, closing application context"); applicationContext.close(); }
From source file:org.opencastproject.remotetest.server.WorkflowAuthorizationTest.java
@Test public void testStartAndRetrieveWorkflowInstance() throws Exception { // Create a series with attached ACLs HttpPost postSeries = new HttpPost(BASE_URL + "/series/"); List<NameValuePair> seriesParams = new ArrayList<NameValuePair>(); seriesParams.add(new BasicNameValuePair("series", getSampleSeries())); seriesParams.add(new BasicNameValuePair("acl", getSampleAcl())); postSeries.setEntity(new UrlEncodedFormEntity(seriesParams, "UTF-8")); HttpResponse seriesResponse = client.execute(postSeries); Assert.assertEquals(200, seriesResponse.getStatusLine().getStatusCode()); EntityUtils.toString(seriesResponse.getEntity()); // Start a workflow instance associated with this series HttpPost postWorkflow = new HttpPost(BASE_URL + "/workflow/start"); List<NameValuePair> workflowParams = new ArrayList<NameValuePair>(); workflowParams.add(new BasicNameValuePair("definition", getSampleWorkflowDefinition())); workflowParams.add(new BasicNameValuePair("mediapackage", getSampleMediaPackage())); postWorkflow.setEntity(new UrlEncodedFormEntity(workflowParams, "UTF-8")); HttpResponse workflowResponse = client.execute(postWorkflow); Assert.assertEquals(200, workflowResponse.getStatusLine().getStatusCode()); // Grab the new workflow instance from the response String postResponse = EntityUtils.toString(workflowResponse.getEntity()); // Ensure that the mediapackage has a XACML attachment reflecting the series ACLs String xacmlAttachmentId = getXACMLAttachmentId(postResponse); Assert.assertNotNull(xacmlAttachmentId); }
From source file:fi.vm.sade.organisaatio.business.impl.OrganisaatioBusinessServiceImplTest.java
@Test public void processOrganisaatiosuhdeChangesOneNewChange() throws Exception { long parentId = 7L; long childId = 4L; String oldParentOid = "1.2.2004.1"; String newParentOid = "1.2.2004.5"; assertChildCountFromIndex(oldParentOid, 2); assertChildCountFromIndex(newParentOid, 0); // Make new organisaatiosuhde change Date time = new Date(); simpleJdbcTemplate.update(//ww w.j a v a 2 s.c om "insert into organisaatiosuhde (id, version, suhdetyyppi, child_id, parent_id, alkupvm) values (9, 1, 'HISTORIA', ?, ?, ?)", childId, parentId, time); // End old organisaatiosuhde simpleJdbcTemplate.update("update organisaatiosuhde set loppupvm = ? where id = ?", time, 3); Assert.assertEquals("Row count should match!", 9, countRowsInTable("organisaatiosuhde")); List<Organisaatio> results = service.processNewOrganisaatioSuhdeChanges(); Assert.assertNotNull(results); Assert.assertEquals("Results size does not match!", 1, results.size()); Organisaatio modified = results.get(0); Assert.assertEquals("Modified organisation does not match!", Long.valueOf(4), modified.getId()); Assert.assertEquals("Parent oid path should match!", "|" + rootOid + "|" + newParentOid + "|", modified.getParentOidPath()); Organisaatio org = checkParentOidPath(modified, "1.2.2004.4"); checkParentOidPath(modified, "1.2.2005.4"); checkParentOidPath(org, "1.2.2005.5"); checkParent(modified, "1.2.2004.4"); checkParent(modified, "1.2.2005.4"); checkParent(org, "1.2.2005.5"); assertChildCountFromIndex(oldParentOid, 1); assertChildCountFromIndex(newParentOid, 1); }