List of usage examples for junit.framework Assert assertNotNull
static public void assertNotNull(Object object)
From source file:com.google.api.ads.adwords.awreporting.model.persistence.sql.SqlReportEntitiesPersisterTest.java
/** * Tests the persistence and retrieval of Report Entities. */// w ww.j av a 2s .co m @Test public void testTokenPersistence() { ReportBase report = new ReportAccount(123L, 456L); report.setAccountDescriptiveName("testAccount"); report.setId(); List<Report> reportList = Lists.newArrayList(); reportList.add(report); reportEntitiesPersister.persistReportEntities(reportList); List<ReportAccount> reportAccountList = reportEntitiesPersister.listReports(ReportAccount.class); Assert.assertNotNull(reportAccountList); Assert.assertTrue(reportAccountList.size() == 1); Assert.assertTrue(reportAccountList.get(0).getTopAccountId().equals(123L)); Assert.assertTrue(reportAccountList.get(0).getAccountId().equals(456L)); Assert.assertTrue(reportAccountList.get(0).getAccountDescriptiveName().equals("testAccount")); report = new ReportAccount(789L, 456L); report.setAccountDescriptiveName("updatedTestAccount"); reportList = Lists.newArrayList(); reportList.add(report); reportEntitiesPersister.persistReportEntities(reportList); reportAccountList = reportEntitiesPersister.listReports(ReportAccount.class); Assert.assertNotNull(reportAccountList); Assert.assertTrue(reportAccountList.size() == 1); Assert.assertTrue(reportAccountList.get(0).getTopAccountId().equals(789L)); Assert.assertTrue(reportAccountList.get(0).getAccountId().equals(456L)); Assert.assertTrue(reportAccountList.get(0).getAccountDescriptiveName().equals("updatedTestAccount")); this.reportEntitiesPersister.remove(reportAccountList); }
From source file:de.hybris.platform.b2b.services.impl.B2BCostCenterServiceTest.java
@Test public void testFindCostCentersAndBudgets() throws Exception { final String userId = "GC CEO"; final B2BCustomerModel customer = login(userId); LOG.debug("Customer : " + customer.getUid()); final B2BCostCenterModel costCenter = (B2BCostCenterModel) b2bCostCenterService .getCostCenterForCode("GC 2.4"); Assert.assertNotNull(costCenter); final Set<B2BBudgetModel> budgetSet = costCenter.getBudgets(); Assert.assertTrue(CollectionUtils.isNotEmpty(budgetSet)); }
From source file:ejportal.webapp.action.JournalActionTest.java
/** * Test save.// w ww .jav a 2s . c o m * * @throws Exception * the exception */ public void testSave() throws Exception { final MockHttpServletRequest request = new MockHttpServletRequest(); ServletActionContext.setRequest(request); this.action.setJournalId(1L); Assert.assertEquals("edit", this.action.edit()); Assert.assertNotNull(this.action.getJournalBaseTO()); // update Kurztitel and save this.action.getJournalBaseTO().setTitel("Updated Kurztitel"); Assert.assertEquals("success", this.action.save()); Assert.assertEquals("Updated Kurztitel", this.action.getJournalBaseTO().getTitel()); Assert.assertFalse(this.action.hasActionErrors()); Assert.assertFalse(this.action.hasFieldErrors()); Assert.assertNotNull(request.getSession().getAttribute("messages")); }
From source file:org.openmrs.module.webservices.rest.web.v1_0.controller.ConceptDescriptionControllerTest.java
/** * @See {@link ConceptDescriptionResource#getByUniqueId(String)} * @throws Exception//from w w w . ja v a 2 s . co m */ @Test public void shouldGetAConceptDescription() throws Exception { 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.assertNull(PropertyUtils.getProperty(result, "auditInfo")); }
From source file:io.cloudslang.lang.compiler.PreCompileTransformersTest.java
@Test public void testPreCompileSensitiveInputsAndOutputsWithAndWithoutDefault() throws Exception { URI resource = getClass().getResource("/check_weather_flow_sensitive_inputs_outputs.sl").toURI(); ExecutableModellingResult result = compiler.preCompileSource(SlangSource.fromFile(resource)); Assert.assertNotNull(result); List<RuntimeException> errors = result.getErrors(); Assert.assertNotNull(errors);/*from w w w .ja v a2 s . c om*/ Assert.assertTrue(errors.size() == 0); Executable executable = result.getExecutable(); Assert.assertNotNull(executable); List<Input> inputs = executable.getInputs(); Assert.assertEquals(3, inputs.size()); Assert.assertEquals("flow_input_1", inputs.get(0).getName()); Assert.assertEquals("defaultValue", inputs.get(0).getValue().get()); Assert.assertEquals(false, inputs.get(0).getValue().isSensitive()); Assert.assertEquals("flow_input_0", inputs.get(1).getName()); Assert.assertEquals("${flow_input_1}", inputs.get(1).getValue().get()); Assert.assertEquals(true, inputs.get(1).getValue().isSensitive()); Assert.assertEquals("flow_input_sensitive", inputs.get(2).getName()); Assert.assertEquals(null, inputs.get(2).getValue().get()); Assert.assertEquals(true, inputs.get(2).getValue().isSensitive()); List<Output> outputs = executable.getOutputs(); Assert.assertEquals(2, outputs.size()); Assert.assertEquals("flow_output_0", outputs.get(0).getName()); Assert.assertEquals("${flow_input_1}", outputs.get(0).getValue().get()); Assert.assertEquals(true, outputs.get(0).getValue().isSensitive()); Assert.assertEquals("flow_output_1", outputs.get(1).getName()); Assert.assertEquals("${flow_output_1}", outputs.get(1).getValue().get()); Assert.assertEquals(true, outputs.get(1).getValue().isSensitive()); }
From source file:ejportal.webapp.action.KonsortiumActionTest.java
/** * Test save.//from w w w . jav a2 s. c o m * * @throws Exception * the exception */ public void testSave() throws Exception { final MockHttpServletRequest request = new MockHttpServletRequest(); ServletActionContext.setRequest(request); this.action.setKonsortiumId(1L); Assert.assertEquals("edit", this.action.edit()); Assert.assertNotNull(this.action.getKonsortium()); // update Name and save this.action.getKonsortium().setKonsortiumName("Updated Name"); Assert.assertEquals("success", this.action.save()); Assert.assertEquals("Updated Name", this.action.getKonsortium().getKonsortiumName()); Assert.assertFalse(this.action.hasActionErrors()); Assert.assertFalse(this.action.hasFieldErrors()); Assert.assertNotNull(request.getSession().getAttribute("messages")); }
From source file:org.openxdata.server.service.impl.UserServiceTest.java
@Test public void deleteUser_shouldDeleteGivenUser() throws Exception { final String userName = "User Name"; List<User> users = userService.getUsers(); Assert.assertEquals("There are 5 users", 5, users.size()); Assert.assertNull(getUser(userName, users)); User user = new User(userName); user.setCreator(users.get(0));/* ww w . ja va2 s . c om*/ user.setDateCreated(new Date()); userService.saveUser(user); users = userService.getUsers(); Assert.assertEquals("Added 1 user so now there are 6", 6, users.size()); user = getUser(userName, users); Assert.assertNotNull(user); userService.deleteUser(user); users = userService.getUsers(); Assert.assertEquals("Deleted the user so now there are 5", 5, users.size()); Assert.assertNull(getUser(userName, users)); }
From source file:org.springsource.examples.expenses.TestDatabaseChargeService.java
@Test public void testChargeReconciliation() throws Throwable { List<Charge> eligibleCharges = chargeService.getEligibleCharges(); Assert.assertNotNull(eligibleCharges); Assert.assertTrue(eligibleCharges.size() == 2); for (Charge c : eligibleCharges) { chargeService.markAsPaid(c.getId()); }//from w w w .ja v a2s. c om Assert.assertTrue(chargeService.getEligibleCharges().size() == 0); }
From source file:ejportal.webapp.action.InstitutionActionTest.java
/** * Test save./*w ww.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.setId(1L); Assert.assertEquals("edit", this.action.edit()); Assert.assertNotNull(this.action.getInstitutionBaseTO()); // update Name and save this.action.getInstitutionBaseTO().setName("Updated Name"); Assert.assertEquals("success", this.action.save()); Assert.assertEquals("Updated Name", this.action.getInstitutionBaseTO().getName()); Assert.assertFalse(this.action.hasActionErrors()); Assert.assertFalse(this.action.hasFieldErrors()); Assert.assertNotNull(request.getSession().getAttribute("messages")); }
From source file:fulcrum.xml.ParserTest.java
private void testXOM(String fileName) { long s = System.currentTimeMillis(); getStartLine("XOM", fileName); Builder parser = new Builder(); try {/* w ww. ja va2 s. c o m*/ Document d = parser.build(getInputStream(fileName)); Assert.assertNotNull(d); } catch (Exception e) { e.printStackTrace(); } getEndLine("XOM", fileName, s); }