List of usage examples for junit.framework Assert assertNotNull
static public void assertNotNull(Object object)
From source file:com.tasktop.c2c.server.scm.service.ScmServiceBeanTest.java
@Test public void testCreateInternalRepo() throws Exception { List<ScmRepository> repoSet = scmService.getScmRepositories(); assertEquals(0, repoSet.size());//from w w w .j a v a2 s . co m ScmRepository newRepo = setupTestRepo(); String repoSsh = "ssh://localhost/" + projId + "/" + newRepo.getName(); scmService.createScmRepository(newRepo); repoSet = scmService.getScmRepositories(); assertEquals(1, repoSet.size()); ScmRepository retrievedRepo = repoSet.iterator().next(); assertEquals(newRepo.getType(), retrievedRepo.getType()); assertEquals(newRepo.getScmLocation(), retrievedRepo.getScmLocation()); assertEquals(newRepo.getUrl(), retrievedRepo.getUrl()); Assert.assertNotNull(retrievedRepo.getAlternateUrl()); assertEquals(repoSsh, retrievedRepo.getAlternateUrl()); assertEquals(newRepo.getDescription(), retrievedRepo.getDescription()); }
From source file:ejportal.webapp.action.RechnungActionTest.java
/** * Test save./*ww w. ja v a 2 s .c om*/ * * @throws Exception * the exception */ public void testSave() throws Exception { final MockHttpServletRequest request = new MockHttpServletRequest(); ServletActionContext.setRequest(request); this.action.setRechnungId(1L); Assert.assertEquals("edit", this.action.edit()); Assert.assertNotNull(this.action.getRechnungBaseTO()); // update bezugsform and save this.action.getRechnungBaseTO().setBezugsform("Updated Bezugsform"); Assert.assertEquals("success", this.action.save()); Assert.assertEquals("Updated Bezugsform", this.action.getRechnungBaseTO().getBezugsform()); Assert.assertFalse(this.action.hasActionErrors()); Assert.assertFalse(this.action.hasFieldErrors()); Assert.assertNotNull(request.getSession().getAttribute("messages")); }
From source file:ejportal.webapp.action.ExemplarActionTest.java
/** * Test save./*www . j a v a2 s . co m*/ * * @throws Exception * the exception */ public void testSave() throws Exception { final MockHttpServletRequest request = new MockHttpServletRequest(); ServletActionContext.setRequest(request); this.action.setExemplarId(1L); Assert.assertEquals("edit", this.action.edit()); Assert.assertNotNull(this.action.getExemplarBaseTO()); // update Name and save this.action.getExemplarBaseTO().setForm("Updated Form"); Assert.assertEquals("success", this.action.save()); Assert.assertEquals("Updated Form", this.action.getExemplarBaseTO().getForm()); Assert.assertFalse(this.action.hasActionErrors()); Assert.assertFalse(this.action.hasFieldErrors()); Assert.assertNotNull(request.getSession().getAttribute("messages")); }
From source file:de.hybris.platform.integration.cis.tax.strategies.impl.DefaultCisCalculateExternalTaxesFallbackStrategyTest.java
@Test public void shouldCalculateTaxesWithFallbackForOrderWithZeroDeliveryCost() { given(abstractOrder.getDeliveryCost()).willReturn(null); final ExternalTaxDocument taxDocument = defaultCisCalculateExternalTaxesFallbackStrategy .calculateExternalTaxes(abstractOrder); Assert.assertNotNull(taxDocument); Assert.assertTrue(taxDocument.getAllTaxes().size() > 0); Assert.assertTrue(taxDocument.getShippingCostTaxes().size() == 0); }
From source file:ejportal.webapp.action.BestellerActionTest.java
/** * Test save.// w w w.j ava 2 s .c o m * * @throws Exception * the exception */ public void testSave() throws Exception { final MockHttpServletRequest request = new MockHttpServletRequest(); ServletActionContext.setRequest(request); this.action.setBestellerId(1L); Assert.assertEquals("edit", this.action.edit()); Assert.assertNotNull(this.action.getBestellerBaseTO()); // update Name and save this.action.getBestellerBaseTO().setBestellerName("Updated Name"); Assert.assertEquals("success", this.action.save()); Assert.assertEquals("Updated Name", this.action.getBestellerBaseTO().getBestellerName()); Assert.assertFalse(this.action.hasActionErrors()); Assert.assertFalse(this.action.hasFieldErrors()); Assert.assertNotNull(request.getSession().getAttribute("messages")); }
From source file:com.idtmatter.insta4j.client.FullInstaClientTest.java
@Test public void authorizeTest() throws FailedLoginException { final FullInstaClient client = FullInstaClient.create("jinstapaper@gmail.com", "open"); final Map<String, String> authorize = client.authorize("jinstapaper@gmail.com", "open"); Assert.assertNotNull(authorize); Assert.assertNotNull(authorize.get("oauth_token")); Assert.assertNotNull(authorize.get("oauth_token_secret")); }
From source file:com.googlecode.t7mp.TomcatArtifactDispatcherTest.java
@Test public void testArtifactDispatcher() throws MojoExecutionException, IOException { TomcatArtifactDispatcher dispatcher = new TomcatArtifactDispatcher(myArtifactResolver, catalinaBaseDir, Mockito.mock(SetupUtil.class), Mockito.mock(Log.class)); Artifact artifact = Mockito.mock(Artifact.class); Mockito.when(artifact.getArtifactId()).thenReturn(ArtifactConstants.ARTIFACTID); Mockito.when(artifact.getGroupId()).thenReturn(ArtifactConstants.GROUPID); Mockito.when(artifact.getVersion()).thenReturn(ArtifactConstants.VERSION); Mockito.when(artifact.getClassifier()).thenReturn(ArtifactConstants.CLASSIFIER); Mockito.when(artifact.getType()).thenReturn(ArtifactConstants.JAR_TYPE); Mockito.when(artifact.getFile()).thenReturn(sourceFile); Mockito.when(myArtifactResolver.resolve(Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString())).thenReturn(artifact); List<? extends AbstractArtifact> artifactList = getArtifacList(); dispatcher.resolveArtifacts(artifactList); Assert.assertNotNull(dispatcher.resolvedArtifacts); Assert.assertTrue(artifactList.size() == dispatcher.resolvedArtifacts.size()); for (AbstractArtifact a : dispatcher.resolvedArtifacts) { Assert.assertEquals(a.getArtifactId(), a.getArtifact().getArtifactId()); Assert.assertEquals(a.getGroupId(), a.getArtifact().getGroupId()); Assert.assertEquals(a.getVersion(), a.getArtifact().getVersion()); }//from www . j a v a 2s. c o m File targetDir = new File(catalinaBaseDir, "lib"); targetDir.mkdirs(); Assert.assertTrue(targetDir.exists()); dispatcher.copyTo(targetDir.getName()); File[] targetFiles = targetDir.listFiles(new FilesOnlyFileFilter()); Assert.assertTrue(targetFiles.length == 2); for (File f : targetFiles) { System.out.println(f.getAbsolutePath()); Assert.assertTrue( f.getName().equals(ArtifactConstants.ARTIFACTID + "-" + ArtifactConstants.VERSION + ".jar") || f.getName().equals(ArtifactConstants.ARTIFACTID + ".war")); } dispatcher.clear(); Assert.assertTrue(dispatcher.resolvedArtifacts.size() == 0); }
From source file:org.openmrs.module.webservices.rest.web.v1_0.controller.ConceptNameControllerTest.java
@Test public void shouldListNamesForAConcept() throws Exception { SimpleObject results = controller.getAll(conceptUuid2, request, response); List<Object> resultsList = (List<Object>) PropertyUtils.getProperty(results, "results"); Assert.assertNotNull(results); Assert.assertEquals(3, resultsList.size()); List<Object> names = Arrays.asList(PropertyUtils.getProperty(resultsList.get(0), "name"), PropertyUtils.getProperty(resultsList.get(1), "name"), PropertyUtils.getProperty(resultsList.get(2), "name")); Assert.assertTrue(names.contains("CD4 COUNT")); Assert.assertTrue(names.contains("CD4")); Assert.assertTrue(names.contains("CD3+CD4+ABS CNT")); }
From source file:io.cloudslang.engine.node.repositories.WorkerNodeRepositoryTest.java
@Test public void createTest() { String bulkNum = UUID.randomUUID().toString(); String wrv = UUID.randomUUID().toString(); WorkerNode worker = new WorkerNode(); worker.setUuid("1234"); worker.setHostName("worker host name"); worker.setInstallPath("faked installation path"); worker.setPassword("faked password"); worker.setStatus(WorkerStatus.RUNNING); worker.setActive(true);/*from w ww. j a v a 2s .c o m*/ worker.setGroups(Arrays.asList("group1", "group2", "group3")); worker.setBulkNumber(bulkNum); worker.setWorkerRecoveryVersion(wrv); workerNodeRepository.saveAndFlush(worker); String result = workerNodeRepository.findByUuid("1234").getBulkNumber(); Assert.assertNotNull(result); result = workerNodeRepository.findByUuid("1234").getWorkerRecoveryVersion(); Assert.assertNotNull(result); }
From source file:eu.trentorise.smartcampus.ac.provider.repository.persistence.AcDaoPersistenceImplTest.java
@Test public void searchUserByToken() { User u = dao.readUser(TOKEN_PRESENT); Assert.assertNotNull(u); u = dao.readUser(TOKEN_NOT_PRESENT); Assert.assertNull(u); }