List of usage examples for junit.framework Assert assertNull
static public void assertNull(Object object)
From source file:eu.trentorise.smartcampus.ac.provider.repository.persistence.AcDaoPersistenceImplTest.java
@Test public void removeUser() { User user = new User(); user.setId((long) 1); Assert.assertNotNull(dao.readUser((long) 1)); Assert.assertTrue(dao.delete(user)); Assert.assertNull(dao.readUser((long) 1)); }
From source file:de.hybris.platform.b2badmin.services.impl.B2BUnitServiceTest.java
@Test public void shouldUpdateBranchInSession() throws Exception { sessionService.executeInLocalView(new SessionExecutionBody() { @Override//w ww. ja va 2 s.c o m public void executeWithoutResult() { final JaloSession currentSession = JaloSession.getCurrentSession(); final DefaultSession session = (DefaultSession) sessionService .getSession(currentSession.getSessionID()); Assert.assertEquals(currentSession, session.getJaloSession()); session.setAttribute("test", new Object()); Assert.assertNotNull(currentSession.getAttribute("test")); final B2BCustomerModel user = (B2BCustomerModel) userService.getUserForUID("IC CEO"); session.setAttribute(B2BConstants.CTX_ATTRIBUTE_BRANCH, null); session.setAttribute(B2BConstants.CTX_ATTRIBUTE_ROOTUNIT, null); Assert.assertNull(currentSession.getAttribute(B2BConstants.CTX_ATTRIBUTE_BRANCH)); Assert.assertNull(currentSession.getAttribute(B2BConstants.CTX_ATTRIBUTE_ROOTUNIT)); b2bUnitService.updateBranchInSession(session, user); Assert.assertNotNull(currentSession.getAttribute(B2BConstants.CTX_ATTRIBUTE_BRANCH)); Assert.assertNotNull(currentSession.getAttribute(B2BConstants.CTX_ATTRIBUTE_ROOTUNIT)); } }, userService.getAdminUser()); }
From source file:com.ebay.cloud.cms.query.service.QueryPaginationByIdTest.java
@Test public void testService03() { QueryContext tempContext = newQueryContext(RAPTOR_REPO, RAPTOR_MAIN_BRANCH_ID); tempContext.setPaginationMode(PaginationMode.ID_BASED); tempContext.setAllowFullTableScan(true); IQueryResult result = queryService.query("ApplicationService.services{@name}.runsOn{@name}", tempContext); List<IEntity> services = (List<IEntity>) result.getEntities(); Assert.assertEquals(10, services.size()); Assert.assertEquals("srp-app:Raptor-00002", services.get(0).getFieldValues("name").get(0)); Assert.assertEquals("srp-app:Raptor-00003", services.get(1).getFieldValues("name").get(0)); Assert.assertFalse(result.hasMoreResults()); Assert.assertNull(result.getNextCursor()); }
From source file:com.netflix.curator.framework.recipes.locks.TestReaper.java
private void testRemove(String namespace) throws Exception { Timing timing = new Timing(); Reaper reaper = null;//from w w w . ja v a2 s. c om CuratorFramework client = makeClient(timing, namespace); try { client.start(); client.create().creatingParentsIfNeeded().forPath("/one/two/three"); Assert.assertNotNull(client.checkExists().forPath("/one/two/three")); reaper = new Reaper(client, 100); reaper.start(); reaper.addPath("/one/two/three"); timing.sleepABit(); Assert.assertNull(client.checkExists().forPath("/one/two/three")); Assert.assertTrue(reaper.removePath("/one/two/three")); client.create().forPath("/one/two/three"); timing.sleepABit(); Assert.assertNotNull(client.checkExists().forPath("/one/two/three")); } finally { IOUtils.closeQuietly(reaper); IOUtils.closeQuietly(client); } }
From source file:com.test.onesignal.MainOneSignalClassRunner.java
@Test public void testOpeningLauncherActivity() throws Exception { AddLauncherIntentFilter();/*ww w. ja va 2 s .co m*/ // From app launching normally Assert.assertNotNull(Shadows.shadowOf(blankActivity).getNextStartedActivity()); OneSignal.handleNotificationOpened(blankActivity, new JSONArray("[{ \"alert\": \"Test Msg\", \"custom\": { \"i\": \"UUID\" } }]"), false); Assert.assertNotNull(Shadows.shadowOf(blankActivity).getNextStartedActivity()); Assert.assertNull(Shadows.shadowOf(blankActivity).getNextStartedActivity()); }
From source file:org.openmrs.module.paperrecord.PaperRecordServiceComponentTest.java
@Test public void testRequestPaperRecordFromChildLocation() { // all these are from the standard test dataset Patient patient = patientService.getPatient(2); Location medicalRecordLocation = locationService.getLocation(1001); Location requestLocation = locationService.getLocation(3); paperRecordService.requestPaperRecord(patient, medicalRecordLocation, requestLocation); // first, make sure that this record is not returned by the "to pull" service method Assert.assertEquals(0, paperRecordService.getOpenPaperRecordRequestsToPull(medicalRecordLocation).size()); // make sure the record is in the database List<PaperRecordRequest> requests = paperRecordService .getOpenPaperRecordRequestsToCreate(medicalRecordLocation); Assert.assertEquals(1, requests.size()); PaperRecordRequest request = requests.get(0); Assert.assertEquals(new Integer(2), request.getPaperRecord().getPatientIdentifier().getPatient().getId()); Assert.assertEquals(new Integer(1), request.getPaperRecord().getRecordLocation().getId()); Assert.assertEquals(new Integer(3), request.getRequestLocation().getId()); Assert.assertEquals("101", request.getPaperRecord().getPatientIdentifier().getIdentifier()); Assert.assertEquals(PaperRecordRequest.Status.OPEN, request.getStatus()); Assert.assertEquals(PaperRecord.Status.PENDING_CREATION, request.getPaperRecord().getStatus()); Assert.assertNull(request.getAssignee()); }
From source file:com.microsoft.windowsazure.mobileservices.sdk.testapp.test.EnhancedPushTests.java
public void testRegisterUnregisterNative() throws Throwable { Context context = getInstrumentation().getTargetContext(); final SharedPreferences sharedPreferences = PreferenceManager .getDefaultSharedPreferences(context.getApplicationContext()); final Container container = new Container(); final String handle = "handle"; String registrationId = "registrationId"; MobileServiceClient client = new MobileServiceClient(appUrl, appKey, context); client = client.withFilter(getUpsertTestFilter(registrationId)); final MobileServicePush push = client.getPush(); forceRefreshSync(push, handle);// w w w .j ava 2s. c o m try { Registration registration = push.register(handle, new String[] { "tag1" }).get(); container.registrationId = registration.getRegistrationId(); container.storedRegistrationId = sharedPreferences .getString(STORAGE_PREFIX + REGISTRATION_NAME_STORAGE_KEY + DEFAULT_REGISTRATION_NAME, null); push.unregister().get(); container.unregister = sharedPreferences .getString(STORAGE_PREFIX + REGISTRATION_NAME_STORAGE_KEY + DEFAULT_REGISTRATION_NAME, null); } catch (Exception exception) { if (exception instanceof ExecutionException) { container.exception = (Exception) exception.getCause(); } else { container.exception = exception; } fail(container.exception.getMessage()); } Assert.assertEquals(registrationId, container.storedRegistrationId); Assert.assertEquals(registrationId, container.registrationId); Assert.assertNull(container.unregister); }
From source file:com.collective.celos.AbstractStateDatabaseTest.java
@Test public void testRegisters() throws Exception { StateDatabaseConnection db = getStateDatabaseConnection(); BucketID bucket1 = new BucketID("foo-bucket-Itrntinliztin"); BucketID bucket2 = new BucketID("another-bucket-Itrntinliztin"); RegisterKey key1 = new RegisterKey("bar-key-Itrntinliztin"); RegisterKey key2 = new RegisterKey("quux-key-Itrntinliztin"); Assert.assertEquals(ImmutableMap.of().entrySet(), db.getAllRegisters(bucket1)); Assert.assertEquals(ImmutableMap.of().entrySet(), db.getAllRegisters(bucket2)); Assert.assertNull(db.getRegister(bucket1, key1)); Assert.assertNull(db.getRegister(bucket2, key2)); ObjectNode value1 = Util.MAPPER.createObjectNode(); value1.put("foo", "Itrntinliztin"); ObjectNode value3 = Util.MAPPER.createObjectNode(); value3.put("bar", "Itrntinliztin"); ObjectNode value2 = Util.MAPPER.createObjectNode(); value2.put("bar", "Internatiolization"); db.putRegister(bucket1, key1, value1); Assert.assertEquals(value1, db.getRegister(bucket1, key1)); Assert.assertEquals(ImmutableMap.of(key1, value1).entrySet(), db.getAllRegisters(bucket1)); Assert.assertNull(db.getRegister(bucket2, key2)); Assert.assertEquals(ImmutableMap.of().entrySet(), db.getAllRegisters(bucket2)); db.putRegister(bucket2, key2, value3); Assert.assertEquals(value1, db.getRegister(bucket1, key1)); Assert.assertEquals(ImmutableMap.of(key1, value1).entrySet(), db.getAllRegisters(bucket1)); Assert.assertEquals(value3, db.getRegister(bucket2, key2)); Assert.assertEquals(ImmutableMap.of(key2, value3).entrySet(), db.getAllRegisters(bucket2)); db.putRegister(bucket2, key2, value2); Assert.assertEquals(value1, db.getRegister(bucket1, key1)); Assert.assertEquals(ImmutableMap.of(key1, value1).entrySet(), db.getAllRegisters(bucket1)); Assert.assertEquals(value2, db.getRegister(bucket2, key2)); Assert.assertEquals(ImmutableMap.of(key2, value2).entrySet(), db.getAllRegisters(bucket2)); db.deleteRegister(bucket1, key1);/*from ww w.j a va2s . co m*/ Assert.assertNull(db.getRegister(bucket1, key1)); Assert.assertEquals(ImmutableMap.of().entrySet(), db.getAllRegisters(bucket1)); Assert.assertEquals(value2, db.getRegister(bucket2, key2)); Assert.assertEquals(ImmutableMap.of(key2, value2).entrySet(), db.getAllRegisters(bucket2)); db.deleteRegister(bucket2, key2); Assert.assertNull(db.getRegister(bucket1, key1)); Assert.assertEquals(ImmutableMap.of().entrySet(), db.getAllRegisters(bucket1)); Assert.assertNull(db.getRegister(bucket2, key2)); Assert.assertEquals(ImmutableMap.of().entrySet(), db.getAllRegisters(bucket2)); db.putRegister(bucket2, key2, value2); Assert.assertNull(db.getRegister(bucket1, key1)); Assert.assertEquals(ImmutableMap.of().entrySet(), db.getAllRegisters(bucket1)); Assert.assertEquals(value2, db.getRegister(bucket2, key2)); Assert.assertEquals(ImmutableMap.of(key2, value2).entrySet(), db.getAllRegisters(bucket2)); db.putRegister(bucket2, key2, value3); Assert.assertNull(db.getRegister(bucket1, key1)); Assert.assertEquals(ImmutableMap.of().entrySet(), db.getAllRegisters(bucket1)); Assert.assertEquals(value3, db.getRegister(bucket2, key2)); Assert.assertEquals(ImmutableMap.of(key2, value3).entrySet(), db.getAllRegisters(bucket2)); db.deleteRegister(bucket2, key2); Assert.assertNull(db.getRegister(bucket1, key1)); Assert.assertEquals(ImmutableMap.of().entrySet(), db.getAllRegisters(bucket1)); Assert.assertNull(db.getRegister(bucket2, key2)); Assert.assertEquals(ImmutableMap.of().entrySet(), db.getAllRegisters(bucket2)); }
From source file:com.test.onesignal.MainOneSignalClassRunner.java
@Test public void testOpeningLaunchUrl() throws Exception { // Clear app launching normally Shadows.shadowOf(blankActivity).getNextStartedActivity(); // No OneSignal init here to test case where it is located in an Activity. OneSignal.handleNotificationOpened(blankActivity, new JSONArray( "[{ \"alert\": \"Test Msg\", \"custom\": { \"i\": \"UUID\", \"u\": \"http://google.com\" } }]"), false);//from w ww . j a v a 2s . c o m Intent intent = Shadows.shadowOf(blankActivity).getNextStartedActivity(); Assert.assertEquals("android.intent.action.VIEW", intent.getAction()); Assert.assertEquals("http://google.com", intent.getData().toString()); Assert.assertNull(Shadows.shadowOf(blankActivity).getNextStartedActivity()); }
From source file:org.openmrs.module.webservices.rest.web.v1_0.controller.ObsControllerTest.java
/** * @see ObsController#purgeObs(String,WebRequest,HttpServletResponse) * @verifies purge a simple obs//from w ww . j a v a 2 s.c om */ @Test public void purgeObs_shouldPurgeASimpleObs() throws Exception { Assert.assertNotNull(Context.getObsService().getObsByUuid("39fb7f47-e80a-4056-9285-bd798be13c63")); new ObsController().purge("39fb7f47-e80a-4056-9285-bd798be13c63", emptyRequest(), new MockHttpServletResponse()); Assert.assertNull(Context.getObsService().getObsByUuid("39fb7f47-e80a-4056-9285-bd798be13c63")); }