List of usage examples for java.util Date getMonth
@Deprecated public int getMonth()
From source file:de.escoand.readdaily.PlayerDialogFragment.java
public void setDate(@NonNull final Context context, @NonNull final Date date) { this.date = date; // image/*from w w w .j a v a2s.com*/ switch (date.getMonth()) { case 0: image = R.mipmap.img_month_01; break; case 1: image = R.mipmap.img_month_02; break; case 2: image = R.mipmap.img_month_03; break; case 3: image = R.mipmap.img_month_04; break; case 4: image = R.mipmap.img_month_05; break; case 5: image = R.mipmap.img_month_06; break; case 6: image = R.mipmap.img_month_07; break; case 7: image = R.mipmap.img_month_08; break; case 8: image = R.mipmap.img_month_09; break; case 9: image = R.mipmap.img_month_10; break; case 10: image = R.mipmap.img_month_11; break; case 11: image = R.mipmap.img_month_12; break; default: // do nothing break; } final Cursor c = Database.getInstance(context).getDay(date, Database.COLUMN_TYPE + " IN (?,?)", new String[] { Database.TYPE_EXEGESIS, Database.TYPE_MEDIA }); while (c.moveToNext()) switch (c.getString(c.getColumnIndex(Database.COLUMN_TYPE))) { // title case Database.TYPE_EXEGESIS: title = c.getString(c.getColumnIndex(Database.COLUMN_TITLE)); break; // media case Database.TYPE_MEDIA: player = MediaPlayer.create(context, Uri.parse(c.getString(c.getColumnIndex(Database.COLUMN_SOURCE)))); player.setOnCompletionListener(this); break; // do nothing default: break; } c.close(); }
From source file:eu.inmite.apps.smsjizdenka.util.SmsParser.java
private Date parseDate(String text, String datePattern, SimpleDateFormat sdf, SimpleDateFormat sdfTime, Ticket ticket) {/*from ww w . j av a 2 s. com*/ Matcher m = Pattern.compile(datePattern).matcher(text); if (m.find()) { String d = m.group(1); if (!isEmpty(d)) { d = d.replaceAll(";", ""); for (int i = 0; i < 2; i++) { final Date date; try { if (i == 0) { date = sdf.parse(d); // full date/time } else if (i == 1 && sdfTime != null) { date = sdfTime.parse(d); // only time } else { break; } } catch (Exception e) { continue; } if (i == 1 && ticket != null && ticket.validFrom != null) { final Date prevDate = ticket.validFrom; date.setYear(prevDate.getYear()); date.setMonth(prevDate.getMonth()); date.setDate(prevDate.getDate()); } return date; } } } throw new RuntimeException("Cannot parse date from the message " + text); }
From source file:org.openmrs.module.laboratory.web.export.DownloadService.java
public void downloadXLS(@ModelAttribute ExportAttributeDetailsApi adts, HttpServletRequest request, HttpServletResponse response) throws ClassNotFoundException, ParseException { // 1. Create new workbook HSSFWorkbook workbook = new HSSFWorkbook(); // 2. Create new worksheet HSSFSheet worksheet = workbook.createSheet("Patient Lab Result Report"); // 3. Define starting indices for rows and columns int startRowIndex = 0; int startColIndex = 0; // 4. Build layout // Build title, date, and column headers ExportLayouter.buildReport(worksheet, startRowIndex, startColIndex); // 5. Fill report ExportFillManager.fillReport(worksheet, startRowIndex, startColIndex, getDatasource(adts, request)); // 6. Set the response properties String months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; //ghanshyam 4-oct-2012 Support #405 [Laboratory]Export workList excel sheet name should include the investigation date not current date String dateStr = adts.getDateStr(); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); Date date = new Date(); date = sdf.parse(dateStr);/*from ww w . ja va 2 s . c o m*/ Calendar calendar = Calendar.getInstance(); calendar.setTime(date); String day = Integer.toString(date.getDate()); String month = months[date.getMonth()]; String year = Integer.toString(calendar.get(Calendar.YEAR)); String dayMonthYear = day + "-" + month + "-" + year; String fileName = "PatientLabResultReport" + dayMonthYear + ".xls"; response.setHeader("Content-Disposition", "inline; filename=" + fileName); // Make sure to set the correct content type response.setContentType("application/vnd.ms-excel"); // 7. Write to the output stream ExportWriter.write(response, worksheet); }
From source file:org.kuali.kra.service.impl.PersonEditableServiceImpl.java
public void populateContactFieldsFromPersonId(PersonEditableInterface protocolPerson) { DateFormat dateFormat = new SimpleDateFormat(Constants.DEFAULT_DATE_FORMAT_PATTERN); KcPerson person = this.kcPersonService.getKcPersonByPersonId(protocolPerson.getPersonId()); protocolPerson.setSocialSecurityNumber(person.getSocialSecurityNumber()); protocolPerson.setLastName(person.getLastName()); protocolPerson.setFirstName(person.getFirstName()); protocolPerson.setMiddleName(person.getMiddleName()); protocolPerson.setFullName(person.getFullName()); protocolPerson.setPriorName(person.getPriorName()); protocolPerson.setUserName(person.getUserName()); protocolPerson.setEmailAddress(person.getEmailAddress()); //prop_person.setDateOfBirth(person.getDateOfBirth()); try {/*from w w w . jav a 2 s . co m*/ java.util.Date dobUtil = dateFormat.parse(person.getDateOfBirth()); protocolPerson .setDateOfBirth(new java.sql.Date(dobUtil.getYear(), dobUtil.getMonth(), dobUtil.getDate())); } catch (Exception e) { //invalid date protocolPerson.setDateOfBirth(null); } protocolPerson.setAge(person.getAge()); protocolPerson.setAgeByFiscalYear(person.getAgeByFiscalYear()); protocolPerson.setGender(person.getGender()); protocolPerson.setRace(person.getRace()); protocolPerson.setEducationLevel(person.getEducationLevel()); protocolPerson.setDegree(person.getDegree()); protocolPerson.setMajor(person.getMajor()); protocolPerson.setHandicappedFlag(person.getHandicappedFlag()); protocolPerson.setHandicapType(person.getHandicapType()); protocolPerson.setVeteranFlag(person.getVeteranFlag()); protocolPerson.setVeteranType(person.getVeteranType()); protocolPerson.setVisaCode(person.getVisaCode()); protocolPerson.setVisaType(person.getVisaType()); //prop_person.setVisaRenewalDate(person.getVisaRenewalDate()); try { java.util.Date visaUtil = dateFormat.parse(person.getVisaRenewalDate()); protocolPerson.setVisaRenewalDate( new java.sql.Date(visaUtil.getYear(), visaUtil.getMonth(), visaUtil.getDate())); } catch (Exception e) { //invalid date protocolPerson.setVisaRenewalDate(null); } protocolPerson.setHasVisa(person.getHasVisa()); protocolPerson.setOfficeLocation(person.getOfficeLocation()); protocolPerson.setOfficePhone(person.getOfficePhone()); protocolPerson.setSecondaryOfficeLocation(person.getSecondaryOfficeLocation()); protocolPerson.setSecondaryOfficePhone(person.getSecondaryOfficePhone()); protocolPerson.setSchool(person.getSchool()); protocolPerson.setYearGraduated(person.getYearGraduated()); protocolPerson.setDirectoryDepartment(person.getDirectoryDepartment()); protocolPerson.setSaluation(person.getSaluation()); protocolPerson.setCountryOfCitizenship(person.getCountryOfCitizenship()); protocolPerson.setPrimaryTitle(person.getPrimaryTitle()); protocolPerson.setDirectoryTitle(person.getDirectoryTitle()); protocolPerson.setHomeUnit(person.getOrganizationIdentifier()); protocolPerson.setFacultyFlag(person.getFacultyFlag()); protocolPerson.setGraduateStudentStaffFlag(person.getGraduateStudentStaffFlag()); protocolPerson.setResearchStaffFlag(person.getResearchStaffFlag()); protocolPerson.setServiceStaffFlag(person.getServiceStaffFlag()); protocolPerson.setSupportStaffFlag(person.getSupportStaffFlag()); protocolPerson.setOtherAcademicGroupFlag(person.getOtherAcademicGroupFlag()); protocolPerson.setMedicalStaffFlag(person.getMedicalStaffFlag()); protocolPerson.setVacationAccrualFlag(person.getVacationAccrualFlag()); protocolPerson.setOnSabbaticalFlag(person.getOnSabbaticalFlag()); protocolPerson.setIdProvided(person.getIdProvided()); protocolPerson.setIdVerified(person.getIdVerified()); protocolPerson.setAddressLine1(person.getAddressLine1()); protocolPerson.setAddressLine2(person.getAddressLine2()); protocolPerson.setAddressLine3(person.getAddressLine3()); protocolPerson.setCity(person.getCity()); protocolPerson.setCounty(person.getCounty()); protocolPerson.setState(person.getState()); protocolPerson.setPostalCode(person.getPostalCode()); protocolPerson.setCountryCode(person.getCountryCode()); protocolPerson.setFaxNumber(person.getFaxNumber()); protocolPerson.setPagerNumber(person.getPagerNumber()); protocolPerson.setMobilePhoneNumber(person.getMobilePhoneNumber()); protocolPerson.setEraCommonsUserName(person.getEraCommonsUserName()); }
From source file:com.webpagebytes.wpbsample.SampleJob.java
public void execute(JobExecutionContext context) throws JobExecutionException { log.log(Level.INFO, "Sample quartz scheduler started"); // create the email subject value Date yesterday = DateUtility.addDays(DateUtility.getToday(), -1); String subject = String.format("Sample webpagebytes application report(%d/%d/%d)", 1900 + yesterday.getYear(), yesterday.getMonth() + 1, yesterday.getDate()); // various variables used during report generation ByteArrayOutputStream bos_emailBody = new ByteArrayOutputStream(4096); ByteArrayOutputStream bos_emailAttachmentFop = new ByteArrayOutputStream(4096); InputStream is_emailAttachmentFop = null; ByteArrayOutputStream bos_emailAttachmentPdf = new ByteArrayOutputStream(4096); ByteArrayInputStream bis_emailAttachmentPdf = null; try {/*w w w.j a v a2 s. co m*/ // get the content provider instance WPBContentService contentService = WPBContentServiceFactory.getInstance(); WPBContentProvider contentProvider = contentService.getContentProvider(); // create the cmd model WPBModel model = contentService.createModel(); //get the report images for users, transactions, deposits and withdrawals // the images and stored in a map, the image content is base64 encoded Map<String, String> contentImages = new HashMap<String, String>(); NotificationUtility.fetchReportImages(contentProvider, model, contentImages); //populate the model with image values model.getCmsApplicationModel().put("users_img", contentImages.get(NotificationUtility.CONTENT_IMG_USERS)); model.getCmsApplicationModel().put("transactions_img", contentImages.get(NotificationUtility.CONTENT_IMG_TRANSACTIONS)); model.getCmsApplicationModel().put("deposits_img", contentImages.get(NotificationUtility.CONTENT_IMG_DEPOSITS)); model.getCmsApplicationModel().put("withdrawals_img", contentImages.get(NotificationUtility.CONTENT_IMG_WITHDRAWALS)); // get from the GLOBALS parameters the user who will receive the email notification String notificationEmailAddress = model.getCmsModel().get(WPBModel.GLOBALS_KEY) .get("NOTIFICATIONS_EMAIL_ADDRESS"); // get from the GLOBALS parameters the page guid with the email body template String notificationEmailPageGuid = model.getCmsModel().get(WPBModel.GLOBALS_KEY) .get("NOTIFICATIONS_EMAIL_PAGE_GUID"); // get from the GLOBALS parameters the page guid with the PDF report XSL-FO template String notificationEmailAttachmentGuid = model.getCmsModel().get(WPBModel.GLOBALS_KEY) .get("NOTIFICATIONS_EMAIL_PDF_GUID"); if (notificationEmailAddress == null || notificationEmailPageGuid == null || notificationEmailAttachmentGuid == null) { // if any of these is not set then do not sent the email log.log(Level.WARNING, "Sample scheduler not properly configured, will not send any email"); return; } // translate the email body template into the actual body content contentProvider.writePageContent(notificationEmailPageGuid, model, bos_emailBody); // translate the attachment XSL FO template into the actual XSL FO content contentProvider.writePageContent(notificationEmailAttachmentGuid, model, bos_emailAttachmentFop); // need to convert the attachment XSL FO OutputStream into InputStream is_emailAttachmentFop = new ByteArrayInputStream(bos_emailAttachmentFop.toByteArray()); SampleFopService fopService = SampleFopService.getInstance(); fopService.getContent(is_emailAttachmentFop, MimeConstants.MIME_PDF, bos_emailAttachmentPdf); //need to convert the attachment PDF OutputStream into InputStream bis_emailAttachmentPdf = new ByteArrayInputStream(bos_emailAttachmentPdf.toByteArray()); // now we have the email subject, email body, email attachment, we can sent it if (notificationEmailAddress.length() > 0) { EmailUtility emailUtility = EmailUtilityFactory.getInstance(); emailUtility.sendEmail(notificationEmailAddress, "no-reply@webpagebytes.com", subject, bos_emailBody.toString("UTF-8"), "report.pdf", bis_emailAttachmentPdf); } log.log(Level.INFO, "Sample quartz scheduler completed with success"); } catch (Exception e) { log.log(Level.SEVERE, "Exception on quartz scheduler", e); } finally { IOUtils.closeQuietly(bos_emailBody); IOUtils.closeQuietly(bos_emailAttachmentFop); IOUtils.closeQuietly(is_emailAttachmentFop); IOUtils.closeQuietly(bis_emailAttachmentPdf); IOUtils.closeQuietly(bos_emailAttachmentPdf); } }
From source file:org.kuali.coeus.common.impl.editable.PersonEditableServiceImpl.java
public void populateContactFieldsFromPersonId(PersonEditable protocolPerson) { DateFormat dateFormat = new SimpleDateFormat(Constants.DEFAULT_DATE_FORMAT_PATTERN); KcPerson person = this.kcPersonService.getKcPersonByPersonId(protocolPerson.getPersonId()); protocolPerson.setSocialSecurityNumber(person.getSocialSecurityNumber()); protocolPerson.setLastName(person.getLastName()); protocolPerson.setFirstName(person.getFirstName()); protocolPerson.setMiddleName(person.getMiddleName()); protocolPerson.setFullName(person.getFullName()); protocolPerson.setPriorName(person.getPriorName()); protocolPerson.setUserName(person.getUserName()); protocolPerson.setEmailAddress(person.getEmailAddress()); try {/*ww w .j a v a 2 s. c om*/ java.util.Date dobUtil = dateFormat.parse(person.getDateOfBirth()); protocolPerson .setDateOfBirth(new java.sql.Date(dobUtil.getYear(), dobUtil.getMonth(), dobUtil.getDate())); } catch (Exception e) { //invalid date protocolPerson.setDateOfBirth(null); } protocolPerson.setAge(person.getAge()); protocolPerson.setAgeByFiscalYear(person.getAgeByFiscalYear()); protocolPerson.setGender(person.getGender()); protocolPerson.setRace(person.getRace()); protocolPerson.setEducationLevel(person.getEducationLevel()); protocolPerson.setDegree(person.getDegree()); protocolPerson.setMajor(person.getMajor()); protocolPerson.setHandicappedFlag(person.getHandicappedFlag()); protocolPerson.setHandicapType(person.getHandicapType()); protocolPerson.setVeteranFlag(person.getVeteranFlag()); protocolPerson.setVeteranType(person.getVeteranType()); protocolPerson.setVisaCode(person.getVisaCode()); protocolPerson.setVisaType(person.getVisaType()); try { java.util.Date visaUtil = dateFormat.parse(person.getVisaRenewalDate()); protocolPerson.setVisaRenewalDate( new java.sql.Date(visaUtil.getYear(), visaUtil.getMonth(), visaUtil.getDate())); } catch (Exception e) { //invalid date protocolPerson.setVisaRenewalDate(null); } protocolPerson.setHasVisa(person.getHasVisa()); protocolPerson.setOfficeLocation(person.getOfficeLocation()); protocolPerson.setOfficePhone(person.getOfficePhone()); protocolPerson.setSecondaryOfficeLocation(person.getSecondaryOfficeLocation()); protocolPerson.setSecondaryOfficePhone(person.getSecondaryOfficePhone()); protocolPerson.setSchool(person.getSchool()); protocolPerson.setYearGraduated(person.getYearGraduated()); protocolPerson.setDirectoryDepartment(person.getDirectoryDepartment()); protocolPerson.setSaluation(person.getSaluation()); protocolPerson.setCountryOfCitizenship(person.getCountryOfCitizenship()); protocolPerson.setPrimaryTitle(person.getPrimaryTitle()); protocolPerson.setDirectoryTitle(person.getDirectoryTitle()); protocolPerson.setHomeUnit(person.getOrganizationIdentifier()); protocolPerson.setFacultyFlag(person.getFacultyFlag()); protocolPerson.setGraduateStudentStaffFlag(person.getGraduateStudentStaffFlag()); protocolPerson.setResearchStaffFlag(person.getResearchStaffFlag()); protocolPerson.setServiceStaffFlag(person.getServiceStaffFlag()); protocolPerson.setSupportStaffFlag(person.getSupportStaffFlag()); protocolPerson.setOtherAcademicGroupFlag(person.getOtherAcademicGroupFlag()); protocolPerson.setMedicalStaffFlag(person.getMedicalStaffFlag()); protocolPerson.setVacationAccrualFlag(person.getVacationAccrualFlag()); protocolPerson.setOnSabbaticalFlag(person.getOnSabbaticalFlag()); protocolPerson.setIdProvided(person.getIdProvided()); protocolPerson.setIdVerified(person.getIdVerified()); protocolPerson.setAddressLine1(person.getAddressLine1()); protocolPerson.setAddressLine2(person.getAddressLine2()); protocolPerson.setAddressLine3(person.getAddressLine3()); protocolPerson.setCity(person.getCity()); protocolPerson.setCounty(person.getCounty()); protocolPerson.setState(person.getState()); protocolPerson.setPostalCode(person.getPostalCode()); protocolPerson.setCountryCode(person.getCountryCode()); protocolPerson.setFaxNumber(person.getFaxNumber()); protocolPerson.setPagerNumber(person.getPagerNumber()); protocolPerson.setMobilePhoneNumber(person.getMobilePhoneNumber()); protocolPerson.setEraCommonsUserName(person.getEraCommonsUserName()); protocolPerson.setCitizenshipTypeCode(person.getCitizenshipTypeCode()); }
From source file:de.grobox.liberario.TripDetailActivity.java
@SuppressWarnings("deprecation") private void addHeader(Trip trip) { Date d = trip.getFirstDepartureTime(); ((TextView) findViewById(R.id.tripDetailsDurationView)) .setText(DateUtils.getDuration(trip.getFirstDepartureTime(), trip.getLastArrivalTime())); ((TextView) findViewById(R.id.tripDetailsDateView)) .setText(DateUtils.formatDate(this, d.getYear() + 1900, d.getMonth(), d.getDate())); }
From source file:com.javielinux.utils.Utils.java
public static String timeFromTweet(Context cnt, Date timeTweet) { if (Integer.parseInt(Utils.getPreference(cnt).getString("prf_date_format", "1")) == 1) { return diffDate(new Date(), timeTweet); } else {//from w w w . j a va 2 s. c o m Date now = new Date(); if (now.getDay() == timeTweet.getDay() && now.getMonth() == timeTweet.getMonth() && now.getYear() == timeTweet.getYear()) { return DateFormat.getTimeInstance().format(timeTweet); } else { return DateFormat.getDateInstance().format(timeTweet); } } }
From source file:com.datatorrent.contrib.enrich.FileEnrichmentTest.java
@Test public void testEnrichmentOperatorDelimitedFSLoader() throws IOException, InterruptedException { URL origUrl = this.getClass().getResource("/productmapping-delim.txt"); URL fileUrl = new URL(this.getClass().getResource("/").toString() + "productmapping-delim1.txt"); FileUtils.deleteQuietly(new File(fileUrl.getPath())); FileUtils.copyFile(new File(origUrl.getPath()), new File(fileUrl.getPath())); MapEnricher oper = new MapEnricher(); DelimitedFSLoader store = new DelimitedFSLoader(); // store.setFieldDescription("productCategory:INTEGER,productId:INTEGER"); store.setFileName(fileUrl.toString()); store.setSchema(/* ww w. j a va 2 s . co m*/ "{\"separator\":\",\",\"fields\": [{\"name\": \"productCategory\",\"type\": \"Integer\"},{\"name\": \"productId\",\"type\": \"Integer\"},{\"name\": \"mfgDate\",\"type\": \"Date\",\"constraints\": {\"format\": \"dd/MM/yyyy\"}}]}"); oper.setLookupFields(Arrays.asList("productId")); oper.setIncludeFields(Arrays.asList("productCategory", "mfgDate")); oper.setStore(store); oper.setup(null); CollectorTestSink<Map<String, Object>> sink = new CollectorTestSink<>(); @SuppressWarnings({ "unchecked", "rawtypes" }) CollectorTestSink<Object> tmp = (CollectorTestSink) sink; oper.output.setSink(tmp); oper.activate(null); oper.beginWindow(0); Map<String, Object> tuple = Maps.newHashMap(); tuple.put("productId", 3); tuple.put("channelId", 4); tuple.put("amount", 10.0); Kryo kryo = new Kryo(); oper.input.process(kryo.copy(tuple)); oper.endWindow(); oper.deactivate(); /* Number of tuple, emitted */ Assert.assertEquals("Number of tuple emitted ", 1, sink.collectedTuples.size()); Map<String, Object> emitted = sink.collectedTuples.iterator().next(); /* The fields present in original event is kept as it is */ Assert.assertEquals("Number of fields in emitted tuple", 5, emitted.size()); Assert.assertEquals("value of productId is 3", tuple.get("productId"), emitted.get("productId")); Assert.assertEquals("value of channelId is 4", tuple.get("channelId"), emitted.get("channelId")); Assert.assertEquals("value of amount is 10.0", tuple.get("amount"), emitted.get("amount")); /* Check if productCategory is added to the event */ Assert.assertEquals("productCategory is part of tuple", true, emitted.containsKey("productCategory")); Assert.assertEquals("value of product category is 1", 5, emitted.get("productCategory")); Assert.assertTrue(emitted.get("productCategory") instanceof Integer); /* Check if mfgDate is added to the event */ Assert.assertEquals("mfgDate is part of tuple", true, emitted.containsKey("productCategory")); Date mfgDate = (Date) emitted.get("mfgDate"); Assert.assertEquals("value of day", 1, mfgDate.getDate()); Assert.assertEquals("value of month", 0, mfgDate.getMonth()); Assert.assertEquals("value of year", 2016, mfgDate.getYear() + 1900); Assert.assertTrue(emitted.get("mfgDate") instanceof Date); }
From source file:com.datatorrent.contrib.enrich.FileEnrichmentTest.java
@Test public void testEnrichmentOperatorFixedWidthFSLoader() throws IOException, InterruptedException { URL origUrl = this.getClass().getResource("/fixed-width-sample.txt"); MapEnricher oper = new MapEnricher(); FixedWidthFSLoader store = new FixedWidthFSLoader(); store.setFieldDescription(/*from w ww. java 2 s. c o m*/ "Year:INTEGER:4,Make:STRING:5,Model:STRING:40,Description:STRING:40,Price:DOUBLE:8,Date:DATE:10:\"dd:mm:yyyy\""); store.setHasHeader(true); store.setPadding('_'); store.setFileName(origUrl.toString()); oper.setLookupFields(Arrays.asList("Year")); oper.setIncludeFields(Arrays.asList("Year", "Make", "Model", "Price", "Date")); oper.setStore(store); oper.setup(null); CollectorTestSink<Map<String, Object>> sink = new CollectorTestSink<>(); @SuppressWarnings({ "unchecked", "rawtypes" }) CollectorTestSink<Object> tmp = (CollectorTestSink) sink; oper.output.setSink(tmp); oper.activate(null); oper.beginWindow(0); Map<String, Object> tuple = Maps.newHashMap(); tuple.put("Year", 1997); Kryo kryo = new Kryo(); oper.input.process(kryo.copy(tuple)); oper.endWindow(); oper.deactivate(); oper.teardown(); /* Number of tuple, emitted */ Assert.assertEquals("Number of tuple emitted ", 1, sink.collectedTuples.size()); Map<String, Object> emitted = sink.collectedTuples.iterator().next(); /* The fields present in original event is kept as it is */ Assert.assertEquals("Number of fields in emitted tuple", 5, emitted.size()); Assert.assertEquals("Value of Year is 1997", tuple.get("Year"), emitted.get("Year")); /* Check if Make is added to the event */ Assert.assertEquals("Make is part of tuple", true, emitted.containsKey("Make")); Assert.assertEquals("Value of Make", "Ford", emitted.get("Make")); /* Check if Model is added to the event */ Assert.assertEquals("Model is part of tuple", true, emitted.containsKey("Model")); Assert.assertEquals("Value of Model", "E350", emitted.get("Model")); /* Check if Price is added to the event */ Assert.assertEquals("Price is part of tuple", true, emitted.containsKey("Price")); Assert.assertEquals("Value of Price is 3000", 3000.0, emitted.get("Price")); Assert.assertTrue(emitted.get("Price") instanceof Double); /* Check if Date is added to the event */ Assert.assertEquals("Date is part of tuple", true, emitted.containsKey("Date")); Date mfgDate = (Date) emitted.get("Date"); Assert.assertEquals("value of day", 1, mfgDate.getDate()); Assert.assertEquals("value of month", 0, mfgDate.getMonth()); Assert.assertEquals("value of year", 2016, mfgDate.getYear() + 1900); Assert.assertTrue(emitted.get("Date") instanceof Date); }