List of usage examples for junit.framework Assert assertNull
static public void assertNull(Object object)
From source file:org.soybeanMilk.test.unit.web.TestWebGenericConverter.java
@Test public void convert_arrayToNotArrayObject_srcArrayEmpty() throws Exception { String[] src = new String[0]; Integer dest = converter.convert(src, Integer.class); Assert.assertNull(dest); }
From source file:org.openxdata.server.service.impl.TaskServiceTest.java
@Test public void deleteTask_shouldDeleteGivenTask() throws Exception { final String taskName = "Forms Bluetooth"; List<TaskDef> tasks = tasksService.getTasks(); Assert.assertEquals(3, tasks.size()); TaskDef taskDef = tasksService.getTask(taskName); Assert.assertNotNull(taskDef);// w ww . j a v a 2 s .c om tasksService.deleteTask(taskDef); tasks = tasksService.getTasks(); Assert.assertEquals(2, tasks.size()); Assert.assertNull(tasksService.getTask(taskName)); }
From source file:org.jasig.ssp.util.importer.job.BatchInitializerHeaderFailTest.java
@Test public void testHeaderFailTest() throws Exception { deleteDirectory(processDirectoryPath); deleteDirectory(upsertDirectoryPath); Assert.assertTrue(!directoryExists(processDirectoryPath)); Assert.assertTrue(!directoryExists(upsertDirectoryPath)); JobExecution jobExecution = jobLauncherTestUtils.launchJob(); Assert.assertEquals(BatchStatus.FAILED, jobExecution.getStatus()); @SuppressWarnings("unchecked") Map<String, ReportEntry> report = (Map<String, ReportEntry>) jobExecution.getExecutionContext() .get("report"); Assert.assertNull(report); @SuppressWarnings("unchecked") List<ErrorEntry> errors = (List<ErrorEntry>) jobExecution.getExecutionContext().get("errors"); Assert.assertNull(errors);// w w w . j a v a 2 s . c o m List<Throwable> failureExceptions = jobExecution.getAllFailureExceptions(); Assert.assertEquals(new Integer(1), new Integer(failureExceptions.size())); Assert.assertEquals(PartialUploadGuardException.class, failureExceptions.get(0).getClass()); }
From source file:org.openxdata.server.service.impl.SettingServiceTest.java
@Test public void deleteSetting_shouldDeleteSettingWithGivenName() throws Exception { Setting setting = getSetting("epihandyser"); Assert.assertNotNull(setting);/*from ww w . j a v a 2 s. c om*/ settingService.deleteSetting(setting); Assert.assertNull(getSetting("epihandyser")); }
From source file:org.openxdata.server.service.impl.LocaleServiceTest.java
@Test public void deleteLocale_shouldDeleteGivenLocale() throws Exception { final String localeName = "LocaleName"; final String localeKey = "LocaleKey"; List<Locale> locales = localeService.getLocales(); Assert.assertEquals(1, locales.size()); Assert.assertNull(getLocale(localeName, locales)); Locale locale = new Locale(); locale.setName(localeName);/* ww w. j ava2 s .co m*/ locale.setKey(localeKey); locale.setCreator(userService.getUsers().get(0)); locale.setDateCreated(new Date()); locales = new ArrayList<Locale>(); locales.add(locale); localeService.saveLocale(locales); locales = localeService.getLocales(); Assert.assertEquals(2, locales.size()); locale = getLocale(localeName, locales); Assert.assertNotNull(locale); localeService.deleteLocale(locale); locales = localeService.getLocales(); Assert.assertEquals(1, locales.size()); Assert.assertNull(getLocale(localeName, locales)); }
From source file:org.esigate.servlet.impl.HttpServletSessionTest.java
/** * Ensure there is no exception when trying to create a session outside of a request (during background * revalidation). Expected behavior is no exception, but value not set. * // w ww. j ava 2 s.c o m * @see "http://www.esigate.org/mantisbt/view.php?id=229" * @throws Exception */ public void testSetAttributeNoSession() throws Exception { HttpServletRequest request = new MockHttpServletRequestBuilder().protocolVersion("HTTP/1.0").method("GET") .session(null).build(); HttpServletResponse response = mock(HttpServletResponse.class); ServletOutputStream outputStream = new ServletOutputStream() { private ByteArrayOutputStream byteOutputStream = new ByteArrayOutputStream(); @Override public void write(int b) { this.byteOutputStream.write(b); } }; when(response.getOutputStream()).thenReturn(outputStream); ServletContext context = mock(ServletContext.class); RequestFactory requestFactory = new RequestFactory(context); IncomingRequest incomingRequest = requestFactory.create(request, response, null); ResponseSender renderer = new ResponseSender(); renderer.sendResponse(new HttpResponseBuilder().entity("Response").build(), incomingRequest, response); incomingRequest.getSession().setAttribute("test", "value"); // Previous method should have no effect since session cannot be // created. Assert.assertNull(incomingRequest.getSession().getAttribute("test")); }
From source file:io.cloudslang.worker.execution.reflection.ReflectionAdapterTest.java
@Test public void executeControlActionTest_3() { ControlActionMetadata metadata = new ControlActionMetadata( "io.cloudslang.worker.execution.reflection.ReflectionAdapterTestHelper", "myMethod_3"); Map<String, Object> actionData = new HashMap<>(); actionData.put("parameter_1", 5); actionData.put("parameter_2", 3); @SuppressWarnings("unchecked") Map<String, ?> result = (Map<String, ?>) adapter.executeControlAction(metadata, actionData); Assert.assertNull(result); }
From source file:philaman.cput.cardealer.test.repository.OfferedServiceRepositoryTest.java
@Test(dependsOnMethods = "updateOfferedService") public void deleteOfferedService() { repo = ctx.getBean(OfferedServiceRepository.class); OfferedService offeredService = repo.findOne(id); repo.delete(offeredService);// w w w . ja va2s.c om OfferedService deleteService = repo.findOne(id); Assert.assertNull(deleteService); }
From source file:org.openmrs.module.formfilter.web.controller.ViewFormFilterControllerTest.java
/** * @see {@link ViewFormFilterController#deleteFormFilterProperty(ModelMap, javax.servlet.http.HttpSession, int, int)} *///from w w w . jav a 2 s .co m @Test @Verifies(value = "should delete FormFilterProperty by id", method = "deleteFormFilterProperty(ModelMap, javax.servlet.http.HttpSession, int, int)") public void deleteFormFilterProperty_shouldDeleteFormFilterPropertyById() { FormFilterService formFilterService = Context.getService(FormFilterService.class); ViewFormFilterController controller = new ViewFormFilterController(); controller.deleteFormFilterProperty(null, new MockHttpSession(), 1, 0); Assert.assertNull(formFilterService.getFormFilterProperty(1)); }
From source file:net.padaf.xmpbox.parser.XMLValueTypeDescriptionManagerTest.java
@Test public void testPropDesc() throws Exception { List<String> types = new ArrayList<String>(); types.add("type1"); types.add("type2"); List<String> uris = new ArrayList<String>(); uris.add("nsURI1"); uris.add("nsURI2"); List<String> prefixs = new ArrayList<String>(); prefixs.add("pref1"); prefixs.add("pref2"); List<String> descProps = new ArrayList<String>(); descProps.add("descProp1"); descProps.add("descProp2"); XMLValueTypeDescriptionManager xmlParser = new XMLValueTypeDescriptionManager(); xmlParser.addValueTypeDescription(types.get(0), uris.get(0), prefixs.get(0), descProps.get(0)); xmlParser.addValueTypeDescription(types.get(1), uris.get(1), prefixs.get(1), descProps.get(1)); ByteArrayOutputStream bos = new ByteArrayOutputStream(); xmlParser.toXML(bos);/*from ww w . j a v a 2 s. c o m*/ IOUtils.closeQuietly(bos); XMLValueTypeDescriptionManager propRetrieve = new XMLValueTypeDescriptionManager(); InputStream is = new ByteArrayInputStream(bos.toByteArray()); propRetrieve.loadListFromXML(is); List<ValueTypeDescription> vtList = propRetrieve.getValueTypesDescriptionList(); Assert.assertEquals(types.size(), vtList.size()); for (int i = 0; i < vtList.size(); i++) { Assert.assertTrue(types.contains(vtList.get(i).getType())); Assert.assertTrue(uris.contains(vtList.get(i).getNamespaceURI())); Assert.assertTrue(prefixs.contains(vtList.get(i).getPrefix())); Assert.assertTrue(descProps.contains(vtList.get(i).getDescription())); Assert.assertNull(vtList.get(i).getFields()); } }