List of usage examples for junit.framework Assert assertNull
static public void assertNull(Object object)
From source file:com.espertech.esper.regression.view.TestHavingNoGroupBy.java
private void assertNewSpreadEvent(double aprice, double bprice, double spread) { Assert.assertEquals(1, listener.getNewDataList().size()); Assert.assertEquals(1, listener.getLastNewData().length); Assert.assertEquals(1, listener.getOldDataList().size()); Assert.assertNull(listener.getLastOldData()); EventBean theEvent = listener.getLastNewData()[0]; compareSpreadEvent(theEvent, aprice, bprice, spread); listener.reset();//from ww w.ja va 2 s . c o m }
From source file:de.itsvs.cwtrpc.controller.AutowiredRemoteServiceGroupConfigTest.java
@Test public void testGetRemoteServiceInterface() { final AutowiredRemoteServiceGroupConfig config; config = new AutowiredRemoteServiceGroupConfig(); Assert.assertEquals(TestService1.class, config.getRemoteServiceInterface(TestService1Impl.class)); Assert.assertNull(config.getRemoteServiceInterface(TestService10Impl.class)); Assert.assertNull(config.getRemoteServiceInterface(ByteArrayInputStream.class)); }
From source file:org.openmrs.module.paperrecord.PaperRecordServiceComponentTest.java
@Test public void testRequestPaperRecord() { // all these are from the standard test dataset Patient patient = patientService.getPatient(2); Location medicalRecordLocation = locationService.getLocation(1); 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:de.hybris.platform.catalog.jalo.synchronization.ItemCopyCreatorTest.java
@Test public void testUpdatingNullValues() throws JaloBusinessException { final UnitModel u = modelService.create(UnitModel.class); u.setCode("unit-" + System.nanoTime()); u.setUnitType("type"); u.setConversion(Double.valueOf(1.0)); modelService.save(u);/*from w ww.j a v a 2 s . c o m*/ final ProductModel p = modelService.create(ProductModel.class); p.setCatalogVersion((CatalogVersionModel) modelService.get(src)); p.setCode("foo-" + System.nanoTime()); p.setMinOrderQuantity(12); p.setUnit(u); p.setApprovalStatus(ArticleApprovalStatus.APPROVED); modelService.save(p); final Product pJalo = modelService.getSource(p); // 1. create copy -> values are non-null final Product pCopyJalo = (Product) new CatalogVersionSyncCopyContext(syncJob, syncCronJob, worker) { @Override protected Set<Language> getTargetLanguages() { return jaloSession.getC2LManager().getAllLanguages(); } @Override protected SyncSchedule getCurrentSchedule() { return new SyncSchedule(pJalo.getPK(), null, null, Collections.EMPTY_SET, Collections.EMPTY_MAP); } }.copy(pJalo); Assert.assertNotNull("Product not copied", pCopyJalo); final ProductModel pCopy = modelService.get(pCopyJalo); Assert.assertEquals(p.getCode(), pCopy.getCode()); Assert.assertEquals(p.getMinOrderQuantity(), pCopy.getMinOrderQuantity()); Assert.assertEquals(p.getApprovalStatus(), pCopy.getApprovalStatus()); Assert.assertEquals(p.getUnit(), pCopy.getUnit()); // 2. change original -> some values are null now p.setUnit(null); p.setMinOrderQuantity(null); modelService.save(p); Assert.assertNull(p.getMinOrderQuantity()); Assert.assertNull(p.getUnit()); // 3. copy again -> copy should have null values too final Product pCopyJalo2 = (Product) new CatalogVersionSyncCopyContext(syncJob, syncCronJob, worker) { @Override protected Set<Language> getTargetLanguages() { return jaloSession.getC2LManager().getAllLanguages(); } @Override protected SyncSchedule getCurrentSchedule() { return new SyncSchedule(pJalo.getPK(), pCopyJalo.getPK(), null, Collections.EMPTY_SET, Collections.EMPTY_MAP); } }.copy(pJalo); Assert.assertNotNull("Product not copied", pCopyJalo2); final ProductModel pCopy2 = modelService.get(pCopyJalo2); Assert.assertSame(pCopy, pCopy2); modelService.refresh(pCopy2); // unchanged ? Assert.assertEquals(p.getCode(), pCopy2.getCode()); Assert.assertEquals(p.getApprovalStatus(), pCopy2.getApprovalStatus()); // null'ed ? Assert.assertNull(pCopy2.getUnit()); Assert.assertNull(pCopy2.getMinOrderQuantity()); }
From source file:org.netxilia.spi.impl.formula.TestFormulaParser.java
@Test public void testFind() throws NetxiliaResourceException, NetxiliaBusinessException { JavaCCFormulaParserImpl parser = getParser(); ISheet sheet = SheetUtils.sheetWithCell("A1", "abc", "A2", "cde", "A3", "abc"); CellReference ref = parser.find(null, new Formula("=A1=\"abc\""), sheet); Assert.assertNotNull(ref);/*from w w w .j a va2s . c om*/ Assert.assertEquals(0, ref.getRowIndex()); Assert.assertEquals(0, ref.getColumnIndex()); ref = parser.find(ref, new Formula("=A1=\"abc\""), sheet); Assert.assertNotNull(ref); Assert.assertEquals(2, ref.getRowIndex()); Assert.assertEquals(0, ref.getColumnIndex()); ref = parser.find(ref, new Formula("=A1=\"abc\""), sheet); Assert.assertNull(ref); }
From source file:org.openmrs.module.webservices.rest.web.v1_0.controller.OrderControllerTest.java
@Test public void shouldPurgeDrugOrder() throws Exception { Assert.assertNotNull(service.getOrderByUuid(DRUG_ORDER_UUID)); controller.purge(DRUG_ORDER_UUID, request, response); Assert.assertNull(service.getOrderByUuid(DRUG_ORDER_UUID)); }
From source file:org.openmrs.module.idgen.service.IdentifierSourceServiceTest.java
@Test public void getAutoGenerationOptionByPatientIdentifierAndLocation_shouldReturnNullIfNoOptionForLocation() { PatientIdentifierType patientIdentifierType = patientService.getPatientIdentifierType(2); Location location = locationService.getLocation(4); AutoGenerationOption autoGenerationOption = iss.getAutoGenerationOption(patientIdentifierType, location); Assert.assertNull(autoGenerationOption); }
From source file:com.test.onesignal.MainOneSignalClassRunner.java
@Test public void testOpenFromNotificationWhenAppIsInBackground() throws Exception { OneSignal.init(blankActivity, "123456789", ONESIGNAL_APP_ID, new OneSignal.NotificationOpenedHandler() { @Override// w w w .j a v a2 s . co m public void notificationOpened(String message, JSONObject additionalData, boolean isActive) { notificationOpenedMessage = message; } }); Assert.assertNull(notificationOpenedMessage); OneSignal.handleNotificationOpened(blankActivity, new JSONArray("[{ \"alert\": \"Test Msg\", \"custom\": { \"i\": \"UUID\" } }]"), false); Assert.assertEquals("Test Msg", notificationOpenedMessage); threadWait(); }
From source file:org.obiba.onyx.core.etl.participant.impl.XmlParticipantReaderTest.java
/** * Tests processing of an appointment list where an attribute (Gender, line 3) has been assigned value that is not * allowed (i.e., is not with the attribute's "allowed value" list). Reader should not return an error as it is a * validation done in the ParticipantProcessor. * /* w w w . j a v a 2 s.com*/ * @throws IOException if the appointment list could not be read */ @Test public void testProcessWithNotAllowedAttributeValue() throws IOException { XmlParticipantReaderForTest reader = createXmlParticipantReaderForTest(false, TEST_RESOURCES_DIR + "/appointmentList_notAllowedAttributeValue.xml"); reader.setColumnNameToAttributeNameMap(columnNameToAttributeNameMap); reader.setParticipantMetadata(participantMetadata); reader.open(context); List<Participant> participants = new ArrayList<Participant>(); try { while (reader.getIterator().hasNext()) { Participant participant = reader.read(); if (participant != null) participants.add(participant); } } catch (Exception e) { throw new RuntimeException(e); } Assert.assertEquals(3, participants.size()); Assert.assertEquals("Tremblay", participants.get(0).getLastName()); Assert.assertNull(participants.get(0).getGender()); Assert.assertEquals(Gender.MALE, participants.get(1).getGender()); Assert.assertEquals("Casserly", participants.get(2).getLastName()); Assert.assertEquals(Gender.FEMALE, participants.get(2).getGender()); }
From source file:es.tekniker.framework.ktek.commons.mng.server.test.TestCommonsMngServer.java
public void testDeleteUserToken() { log.info("*************************************************************"); log.info("testDeleteUserToken: START "); String result = TestDefines.RESULT_OK; KtekUserEntity instance = null;//from ww w .j ava 2 s . c om CommonsMngServer manager = new CommonsMngServer(); String codUser = "newuser1"; boolean boolOK = false; try { boolOK = manager.deleteUser(codUser); if (boolOK) { System.out.println("testDeleteUserToken OK "); result = TestDefines.RESULT_OK; Assert.assertFalse(true); } else { log.error("testDeleteUserToken: ERROR "); result = TestDefines.RESULT_ERROR; Assert.assertNull(instance); } } catch (KtekExceptionEntity e) { System.out.println("testDeleteUserToken : exception " + e.getMessage()); e.printStackTrace(); Assert.assertFalse(false); } log.info("testDeleteUserToken: RESULT " + result); log.info("testDeleteUserToken: END "); log.info("*************************************************************"); log.info(""); }