List of usage examples for junit.framework Assert assertNull
static public void assertNull(Object object)
From source file:de.hybris.platform.b2badmin.services.impl.B2BUnitServiceTest.java
@Test public void testGetApprovalProcessCode() throws Exception { sessionService.executeInLocalView(new SessionExecutionBody() { @Override/*www.java 2 s . co m*/ public void executeWithoutResult() { final String userId = "IC CEO"; String approvalCode = null; login(userId); // test findApprovalProcessCodeForUnit final B2BUnitModel unit = b2bUnitService.getUnitForUid("IC"); Assert.assertNotNull(unit); // test approvalCode = b2bUnitService.getApprovalProcessCodeForUnit(unit); Assert.assertNull(approvalCode); unit.setApprovalProcessCode("simpleapproval"); modelService.save(unit); approvalCode = b2bUnitService.getApprovalProcessCodeForUnit(unit); Assert.assertNotNull(approvalCode); // test findApprovalProcessCodeForUnit - get value from parent final B2BUnitModel unitSales = b2bUnitService.getUnitForUid("IC Sales"); Assert.assertNotNull(unitSales); approvalCode = b2bUnitService.getApprovalProcessCodeForUnit(unitSales); Assert.assertNotNull(approvalCode); unit.setApprovalProcessCode(null); modelService.save(unit); approvalCode = b2bUnitService.getApprovalProcessCodeForUnit(unitSales); Assert.assertNull(approvalCode); } }, userService.getAdminUser()); }
From source file:org.openmrs.module.emrapi.account.AccountComponentTest.java
@Test public void shouldSetProviderRoleToNull() { Person person = personService.getPerson(501); // existing person with active provider account AccountDomainWrapper account = accountService.getAccountByPerson(person); account.setProviderRole(null);/*from www . j a va 2s .c o m*/ account.save(); Context.flushSession(); Context.clearSession(); List<Provider> providers = providerManagementService.getProvidersByPerson(person, false); Assert.assertEquals(1, providers.size()); Assert.assertNull(providers.get(0).getProviderRole()); }
From source file:com.link_intersystems.lang.ContextAwareTest.java
@Test public void proxyThrowsException() throws Exception { final TestContextAware contextAware = new TestContextAware(); TargetInterface targetInterface = createStrictMock(TargetInterface.class); expect(targetInterface.concat("HELLO ", "WORLD")).andAnswer(new IAnswer<String>() { public String answer() throws Throwable { assertTrue(contextAware.isActivated()); Method2 method = contextAware.getInvocationMethod(); Assert.assertNotNull(method); Method declaredMethod = TargetInterface.class.getDeclaredMethod("concat", String.class, String.class); Assert.assertEquals(declaredMethod, method.getMember()); throw new ClassCastException(); }//w w w. j av a2 s. c o m }); replay(targetInterface); TargetInterface targetInterfaceContextAware = contextAware.createContextProxy(targetInterface); Method2 method = contextAware.getInvocationMethod(); Assert.assertNull(method); try { targetInterfaceContextAware.concat("HELLO ", "WORLD"); } catch (ClassCastException illegalAccessException) { method = contextAware.getInvocationMethod(); Assert.assertNull(method); } assertFalse(contextAware.isActivated()); }
From source file:au.com.gaiaresources.bdrs.controller.theme.ThemeControllerTest.java
@Test public void testEdit() throws Exception { login("root", "password", new String[] { Role.ROOT }); Portal portal = getRequestContext().getPortal(); request.setMethod("GET"); request.setRequestURI("/bdrs/root/theme/edit.htm"); request.setParameter("portalId", portal.getId().toString()); ModelAndView mv = handle(request, response); ModelAndViewAssert.assertViewName(mv, "themeEdit"); ModelAndViewAssert.assertModelAttributeValue(mv, "portalId", portal.getId()); Assert.assertEquals(0, ((List<ThemeFile>) mv.getModel().get("themeFileList")).size()); Assert.assertNull(((Theme) mv.getModel().get("editTheme")).getId()); Assert.assertTrue((Boolean) mv.getModel().get("editAsRoot")); }
From source file:org.openmrs.module.emrapi.account.AccountComponentTest.java
@Test public void shouldHandlePersonWithoutUser() { Person person = personService.getPerson(2); AccountDomainWrapper account = accountService.getAccountByPerson(person); Assert.assertNull(account.getUser()); Assert.assertNull(account.getUsername()); Assert.assertNull(account.getDefaultLocale()); Assert.assertNull(account.getCapabilities()); Assert.assertNull(account.getPrivilegeLevel()); Assert.assertNull(account.getUserEnabled()); }
From source file:com.ebay.cloud.cms.query.service.QueryPaginationByIdTest.java
@Test public void testService01() { QueryContext tempContext = newQueryContext(RAPTOR_REPO, RAPTOR_MAIN_BRANCH_ID); tempContext.setAllowFullTableScan(true); QueryCursor cursor = new QueryCursor(); cursor.setJoinCursorValues(Arrays.asList("", "", "")); cursor.setLimits(new int[] { 0, 2, 0 }); tempContext.setCursor(cursor);/* w w w .java2 s . c om*/ tempContext.setPaginationMode(PaginationMode.ID_BASED); IQueryResult result = queryService.query("ApplicationService.services{@name}.runsOn{@name}", tempContext); List<IEntity> services = (List<IEntity>) result.getEntities(); Assert.assertEquals(1, services.size()); Assert.assertTrue(result.hasMoreResults()); Assert.assertNotNull(result.getNextCursor()); int[] nextLimits = result.getNextCursor().getLimits(); Assert.assertEquals(3, nextLimits.length); Assert.assertEquals(2, nextLimits[1]); Assert.assertEquals(1000, nextLimits[2]); Assert.assertNull(result.getNextCursor().getSkips()); }
From source file:de.odysseus.staxon.json.stream.jackson.JacksonStreamSourceTest.java
@Test public void testLiteralValues() throws IOException { StringReader reader = new StringReader("[true,false,null]"); JacksonStreamSource source = new JacksonStreamSource(new JsonFactory().createParser(reader)); JsonStreamSource.Value value = null; Assert.assertEquals(JsonStreamToken.START_ARRAY, source.peek()); source.startArray();// www . ja v a 2 s.c o m Assert.assertEquals(JsonStreamToken.VALUE, source.peek()); value = source.value(); Assert.assertEquals("true", value.text); Assert.assertEquals(Boolean.TRUE, value.data); Assert.assertEquals(JsonStreamToken.VALUE, source.peek()); value = source.value(); Assert.assertEquals("false", value.text); Assert.assertEquals(Boolean.FALSE, value.data); Assert.assertEquals(JsonStreamToken.VALUE, source.peek()); value = source.value(); Assert.assertNull(value.text); Assert.assertNull(value.data); Assert.assertEquals(JsonStreamToken.END_ARRAY, source.peek()); source.endArray(); Assert.assertEquals(JsonStreamToken.NONE, source.peek()); source.close(); }
From source file:com.espertech.esper.regression.view.TestHavingNoGroupBy.java
private void assertOldSpreadEvent(double aprice, double bprice, double spread) { Assert.assertEquals(1, listener.getOldDataList().size()); Assert.assertEquals(1, listener.getLastOldData().length); Assert.assertEquals(1, listener.getNewDataList().size()); // since event null is put into the list Assert.assertNull(listener.getLastNewData()); EventBean theEvent = listener.getLastOldData()[0]; compareSpreadEvent(theEvent, aprice, bprice, spread); listener.reset();/*from www . j av a 2 s. c om*/ }
From source file:com.netflix.curator.framework.recipes.locks.TestReaper.java
private void testReapUntilGone(String namespace) throws Exception { Timing timing = new Timing(); Reaper reaper = null;//w ww . ja v a 2s. c o m CuratorFramework client = makeClient(timing, namespace); try { client.start(); reaper = new Reaper(client, 100); reaper.start(); reaper.addPath("/one/two/three", Reaper.Mode.REAP_UNTIL_GONE); timing.sleepABit(); client.create().creatingParentsIfNeeded().forPath("/one/two/three"); Assert.assertNotNull(client.checkExists().forPath("/one/two/three")); reaper.addPath("/one/two/three", Reaper.Mode.REAP_UNTIL_GONE); timing.sleepABit(); Assert.assertNull(client.checkExists().forPath("/one/two/three")); } finally { IOUtils.closeQuietly(reaper); IOUtils.closeQuietly(client); } }
From source file:org.openmrs.module.webservices.rest.web.v1_0.controller.OrderControllerTest.java
@Test public void shouldPurgeOrder() throws Exception { Assert.assertNotNull(service.getOrderByUuid(ORDER_UUID)); controller.purge(ORDER_UUID, request, response); Assert.assertNull(service.getOrderByUuid(ORDER_UUID)); }