List of usage examples for org.apache.commons.lang3.time DateUtils addMonths
public static Date addMonths(final Date date, final int amount)
From source file:cn.mypandora.util.MyDateUtils.java
/** * /* w w w. j a v a 2 s . co m*/ * * @param begin * @param end * @return */ public static List<String> getMonthsListBetweenDates(String begin, String end) { List<String> dateList = new ArrayList<String>(); Date d1; Date d2; try { d1 = DateUtils.parseDate(begin, DATE_FORMAT); d2 = DateUtils.parseDate(end, DATE_FORMAT); if (d1.compareTo(d2) > 0) { return dateList; } do { dateList.add(DateFormatUtils.format(d1, MONTH_FORMAT)); d1 = DateUtils.addMonths(d1, 1); } while (d1.compareTo(d2) <= 0); } catch (ParseException e) { e.printStackTrace(); } return dateList; }
From source file:gov.nih.nci.firebird.web.action.investigator.registration.HumanResearchCertificateTabActionTest.java
@Test public void testGetCertificatesAsJson_ExpiredCertificate() throws Exception { profile.addCredential(certificate);//from www . java 2 s .c o m certificate.setExpirationDate(DateUtils.addMonths(new Date(), -1)); String json = action.getCertificatesAsJson(); assertEquals("[]", json); }
From source file:com.inkubator.hrm.service.impl.LogWtAttendanceRealizationServiceImpl.java
@Override @Transactional(readOnly = false, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED, rollbackFor = Exception.class) public void afterMonthEndProcess() throws Exception { /** update payrollType status di periode yg lama menjadi VOID */ WtPeriode wtPeriode = wtPeriodeDao.getEntityByAbsentTypeActive(); wtPeriode.setAbsen(HRMConstant.PERIODE_ABSEN_VOID); wtPeriode.setUpdatedOn(new Date()); wtPeriode.setUpdatedBy(HRMConstant.SYSTEM_ADMIN); wtPeriodeDao.update(wtPeriode);//from w w w . ja v a2 s . co m /** dapatkan range (untilPeriode dan fromPeriode) untuk periode yg baru */ Date untilPeriode = wtPeriode.getUntilPeriode(); Date fromPeriode = DateUtils.addDays(untilPeriode, 1); int lastDateOfMonth = DateUtils.toCalendar(untilPeriode).getActualMaximum(Calendar.DAY_OF_MONTH); if (lastDateOfMonth == DateUtils.toCalendar(untilPeriode).get(Calendar.DATE)) { untilPeriode = DateUtils.addMonths(untilPeriode, 1); lastDateOfMonth = DateUtils.toCalendar(untilPeriode).getActualMaximum(Calendar.DAY_OF_MONTH); untilPeriode = DateUtils.setDays(untilPeriode, lastDateOfMonth); } else { untilPeriode = DateUtils.addMonths(untilPeriode, 1); } /** adding process or update the entity if already exist */ WtPeriode wtp = wtPeriodeDao.getEntityByFromPeriodeAndUntilPeriode(fromPeriode, untilPeriode); if (wtp == null) { wtp = new WtPeriode(); wtp.setId(Long.parseLong(RandomNumberUtil.getRandomNumber(9))); wtp.setTahun(String.valueOf(DateUtils.toCalendar(fromPeriode).get(Calendar.YEAR))); wtp.setBulan(DateUtils.toCalendar(fromPeriode).get(Calendar.MONTH) + 1); wtp.setFromPeriode(fromPeriode); wtp.setUntilPeriode(untilPeriode); wtp.setAbsen(HRMConstant.PERIODE_ABSEN_ACTIVE); wtp.setPayrollType(HRMConstant.PERIODE_PAYROLL_NOT_ACTIVE); long totalHoliday = wtHolidayDao.getTotalBetweenDate(fromPeriode, untilPeriode); int workingDays = DateTimeUtil.getTotalWorkingDay(fromPeriode, untilPeriode, (int) totalHoliday, 0); wtp.setWorkingDays(workingDays); wtp.setCreatedOn(new Date()); wtp.setCreatedBy(HRMConstant.SYSTEM_ADMIN); wtPeriodeDao.save(wtp); } else { wtp.setAbsen(HRMConstant.PERIODE_ABSEN_ACTIVE); wtp.setUpdatedOn(new Date()); wtp.setUpdatedBy(HRMConstant.SYSTEM_ADMIN); wtPeriodeDao.update(wtp); } /** delete all the record in the temporary table **/ tempProcessReadFingerDao.deleteAllData(); tempAttendanceRealizationDao.deleteAllData(); }
From source file:gov.nih.nci.firebird.selenium2.tests.protocol.registration.HumanResearchCertificateTabTest.java
@Test public void testCantSelectExpiredCertificate() throws IOException, CredentialAlreadyExistsException { TrainingCertificate expiredCertificate = CredentialFactory.getInstance() .createCertificate(TestFileUtils.createTemporaryFile(), getExistingExternalOrganization()); expiredCertificate.setEffectiveDate(new Date()); expiredCertificate.setExpirationDate(DateUtils.addMonths(new Date(), -1)); TrainingCertificate activeCertificate = CredentialFactory.getInstance() .createCertificate(TestFileUtils.createTemporaryFile(), getExistingExternalOrganization()); activeCertificate.setEffectiveDate(new Date()); getRegistration().getProfile().addCredential(expiredCertificate); getRegistration().getProfile().addCredential(activeCertificate); dataSet.update(getRegistration().getProfile()); HumanResearchCertificateTab hrcTab = navigateToHumanResearchCertificateTab(); assertNotNull(hrcTab.getHelper().getListing(activeCertificate)); assertNull(hrcTab.getHelper().getListing(expiredCertificate)); }
From source file:de.tor.tribes.ui.components.DatePicker.java
private void firePrevNextAction(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_firePrevNextAction if (evt.getSource().equals(jButtonPrevious)) { selectedDate = DateUtils.addMonths(selectedDate, -1); buildCalendar();/* w ww.j a v a 2s . co m*/ } else if (evt.getSource().equals(jButtonNext)) { selectedDate = DateUtils.addMonths(selectedDate, 1); buildCalendar(); } }
From source file:gov.nih.nci.firebird.selenium2.tests.investigator.annual.registration.common.AbstractAnnualRegistrationTest.java
protected void configureRegistrationDataSet(DataSetBuilder builder, FirebirdUser investigator) { Date now = new Date(); Date initialRegistrationDate = DateUtils.addMonths(now, -11); Date renewalDueDate = DateUtils.addYears(initialRegistrationDate, 1); AnnualRegistration initialRegistration = builder.createAnnualRegistration(investigator) .withType(AnnualRegistrationType.INITIAL).withStatus(RegistrationStatus.APPROVED) .withStatusDate(initialRegistrationDate).complete().get(); builder.createAnnualRegistration(investigator).renewalOf(initialRegistration).withDueDate(renewalDueDate); }
From source file:com.feilong.core.date.DateUtil.java
/** * <code>date</code>?,( {@link java.util.Calendar#MONTH}?,??),,. * /*from w w w .ja v a2 s .c om*/ * <p> * ?<code>date</code>?? * </p> * * <h3>:</h3> * * <blockquote> * * <pre class="code"> * DateUtil.addMonth(2012-10-16 23:12:43,5) =2013-03-16 23:12:43.932 * DateUtil.addMonth(2012-10-16 23:12:43,-5) =2012-05-16 23:12:43.943 * </pre> * * </blockquote> * * @param date * ? * @param month * ?, <span style="color:red">?</span>,??<br> * -3 3? * @return <code>date</code>null, {@link java.lang.IllegalArgumentException} * @see Calendar#MONTH * @see org.apache.commons.lang3.time.DateUtils#addMonths(Date, int) */ public static Date addMonth(Date date, int month) { return DateUtils.addMonths(date, month); }
From source file:com.silverpeas.gallery.dao.MediaDaoTest.java
@Test public void saveNewPhoto() throws Exception { performDAOTest(new DAOTest() { @Override// www . jav a 2 s.c o m public void test(final Connection connection) throws Exception { Date now = DateUtil.getNow(); Date beginVisibilityDate = DateUtils.addMonths(now, -1); Date endVisibilityDate = DateUtils.addMonths(now, 4); Date beginDownloadDate = DateUtils.addDays(now, -10); Date endDownloadDate = DateUtils.addDays(now, 5); Photo newPhoto = new Photo(); newPhoto.setComponentInstanceId(INSTANCE_A); newPhoto.setTitle("A title"); newPhoto.setDescription("A description"); newPhoto.setAuthor("An author"); newPhoto.setKeyWord("keywords"); newPhoto.setVisibilityPeriod(Period.from(beginVisibilityDate, endVisibilityDate)); newPhoto.setFileName("new file name"); newPhoto.setFileSize(2048); newPhoto.setFileMimeType(MediaMimeType.TIFF); newPhoto.setDownloadAuthorized(true); newPhoto.setDownloadPeriod(Period.from(beginDownloadDate, endDownloadDate)); newPhoto.setDefinition(Definition.of(200, 100)); assertThat(newPhoto.getId(), nullValue()); String newId = MediaDAO.saveMedia(connection, OperationContext.fromUser(adminAccessUser), newPhoto); assertThat(newPhoto.getId(), notNullValue()); assertThat(newPhoto.getId(), is(newId)); IDataSet actualDataSet = getActualDataSet(); ITable mediaTable = actualDataSet.getTable("SC_Gallery_Media"); assertThat(mediaTable.getRowCount(), is(MEDIA_ROW_COUNT + 1)); ITable internalTable = actualDataSet.getTable("SC_Gallery_Internal"); assertThat(internalTable.getRowCount(), is(MEDIA_INTERNAL_ROW_COUNT + 1)); ITable photoTable = actualDataSet.getTable("SC_Gallery_Photo"); assertThat(photoTable.getRowCount(), is(MEDIA_PHOTO_ROW_COUNT + 1)); ITable videoTable = actualDataSet.getTable("SC_Gallery_Video"); assertThat(videoTable.getRowCount(), is(MEDIA_VIDEO_ROW_COUNT)); ITable soundTable = actualDataSet.getTable("SC_Gallery_Sound"); assertThat(soundTable.getRowCount(), is(MEDIA_SOUND_ROW_COUNT)); ITable streamingTable = actualDataSet.getTable("SC_Gallery_Streaming"); assertThat(streamingTable.getRowCount(), is(MEDIA_STREAMING_ROW_COUNT)); ITable pathTable = actualDataSet.getTable("SC_Gallery_Path"); assertThat(pathTable.getRowCount(), is(MEDIA_PATH_ROW_COUNT)); TableRow mediaRow = getTableRowFor(mediaTable, "mediaId", newPhoto.getId()); assertThat(mediaRow.getString("mediaId"), is(newId)); assertThat(mediaRow.getString("mediaType"), is(MediaType.Photo.name())); assertThat(mediaRow.getString("instanceId"), is(INSTANCE_A)); assertThat(mediaRow.getString("title"), is("A title")); assertThat(mediaRow.getString("description"), is("A description")); assertThat(mediaRow.getString("author"), is("An author")); assertThat(mediaRow.getString("keyword"), is("keywords")); assertThat(mediaRow.getLong("beginVisibilityDate"), is(beginVisibilityDate.getTime())); assertThat(mediaRow.getLong("endVisibilityDate"), is(endVisibilityDate.getTime())); assertThat(mediaRow.getDate("createDate"), greaterThanOrEqualTo(now)); assertThat(mediaRow.getString("createdBy"), is(adminAccessUser.getId())); assertThat(mediaRow.getDate("lastUpdateDate"), is(mediaRow.getDate("createDate"))); assertThat(mediaRow.getString("lastUpdatedBy"), is(adminAccessUser.getId())); TableRow iMediaRow = getTableRowFor(internalTable, "mediaId", newPhoto.getId()); assertThat(iMediaRow.getString("mediaId"), is(newId)); assertThat(iMediaRow.getString("fileName"), is("new file name")); assertThat(iMediaRow.getLong("fileSize"), is(2048L)); assertThat(iMediaRow.getString("fileMimeType"), is("image/tiff")); assertThat(iMediaRow.getInteger("download"), is(1)); assertThat(iMediaRow.getLong("beginDownloadDate"), is(beginDownloadDate.getTime())); assertThat(iMediaRow.getLong("endDownloadDate"), is(endDownloadDate.getTime())); TableRow photoRow = getTableRowFor(photoTable, "mediaId", newPhoto.getId()); assertThat(photoRow.getString("mediaId"), is(newId)); assertThat(photoRow.getInteger("resolutionH"), is(100)); assertThat(photoRow.getInteger("resolutionW"), is(200)); } }); }
From source file:com.silverpeas.gallery.dao.MediaDaoTest.java
@Test public void saveExistingPhoto() throws Exception { performDAOTest(new DAOTest() { @Override/* w ww . ja va 2s. co m*/ public void test(final Connection connection) throws Exception { Date now = DateUtil.getNow(); Date endVisibilityDate = DateUtils.addMonths(now, 4); Date beginDownloadDate = DateUtils.addDays(now, -10); IDataSet actualDataSet = getActualDataSet(); ITable mediaTable = actualDataSet.getTable("SC_Gallery_Media"); assertThat(mediaTable.getRowCount(), is(MEDIA_ROW_COUNT)); ITable internalTable = actualDataSet.getTable("SC_Gallery_Internal"); assertThat(internalTable.getRowCount(), is(MEDIA_INTERNAL_ROW_COUNT)); ITable photoTable = actualDataSet.getTable("SC_Gallery_Photo"); assertThat(photoTable.getRowCount(), is(MEDIA_PHOTO_ROW_COUNT)); ITable videoTable = actualDataSet.getTable("SC_Gallery_Video"); assertThat(videoTable.getRowCount(), is(MEDIA_VIDEO_ROW_COUNT)); ITable soundTable = actualDataSet.getTable("SC_Gallery_Sound"); assertThat(soundTable.getRowCount(), is(MEDIA_SOUND_ROW_COUNT)); ITable streamingTable = actualDataSet.getTable("SC_Gallery_Streaming"); assertThat(streamingTable.getRowCount(), is(MEDIA_STREAMING_ROW_COUNT)); ITable pathTable = actualDataSet.getTable("SC_Gallery_Path"); assertThat(pathTable.getRowCount(), is(MEDIA_PATH_ROW_COUNT)); String mediaIdToUpdate = "2"; TableRow mediaRow = getTableRowFor(mediaTable, "mediaId", mediaIdToUpdate); assertThat(mediaRow.getString("mediaId"), is(mediaIdToUpdate)); assertThat(mediaRow.getString("mediaType"), is(MediaType.Photo.name())); assertThat(mediaRow.getString("instanceId"), is(INSTANCE_A)); assertThat(mediaRow.getString("title"), is("title 2")); assertThat(mediaRow.getValue("description"), nullValue()); assertThat(mediaRow.getValue("author"), nullValue()); assertThat(mediaRow.getValue("keyword"), nullValue()); assertThat(mediaRow.getLong("beginVisibilityDate"), is(DateUtil.MINIMUM_DATE.getTime())); assertThat(mediaRow.getLong("endVisibilityDate"), is(DateUtil.MAXIMUM_DATE.getTime())); assertThat(mediaRow.getDate("createDate"), is(CREATE_DATE)); assertThat(mediaRow.getString("createdBy"), is("0")); assertThat(mediaRow.getDate("lastUpdateDate"), is(CREATE_DATE)); assertThat(mediaRow.getString("lastUpdatedBy"), is("0")); TableRow iMediaRow = getTableRowFor(internalTable, "mediaId", mediaIdToUpdate); assertThat(iMediaRow.getString("mediaId"), is(mediaIdToUpdate)); assertThat(iMediaRow.getString("fileName"), is("fileName_2")); assertThat(iMediaRow.getLong("fileSize"), is(102L)); assertThat(iMediaRow.getString("fileMimeType"), is("image/png")); assertThat(iMediaRow.getInteger("download"), is(0)); assertThat(iMediaRow.getValue("beginDownloadDate"), nullValue()); assertThat(iMediaRow.getValue("endDownloadDate"), nullValue()); TableRow photoRow = getTableRowFor(photoTable, "mediaId", mediaIdToUpdate); assertThat(photoRow.getString("mediaId"), is(mediaIdToUpdate)); assertThat(photoRow.getInteger("resolutionH"), is(600)); assertThat(photoRow.getInteger("resolutionW"), is(800)); Photo photoToUpdate = MediaDAO .getByCriteria(connection, defaultMediaCriteria().identifierIsOneOf(mediaIdToUpdate)) .getPhoto(); photoToUpdate.setTitle(photoToUpdate.getTitle() + "_updated"); photoToUpdate.setKeyWord("keywords_updated"); photoToUpdate.setVisibilityPeriod(Period.from(DateUtil.MINIMUM_DATE, endVisibilityDate)); photoToUpdate.setFileName(photoToUpdate.getFileName() + "_updated"); photoToUpdate.setFileSize(2048); photoToUpdate.setFileMimeType(MediaMimeType.TIFF); photoToUpdate.setDownloadAuthorized(true); photoToUpdate.setDownloadPeriod(Period.from(beginDownloadDate, DateUtil.MAXIMUM_DATE)); photoToUpdate.setDefinition(Definition.of(200, 100)); String savedMediaId = photoToUpdate.getId(); String mediaId = MediaDAO.saveMedia(connection, OperationContext.fromUser(publisherUser), photoToUpdate); assertThat(mediaId, is(savedMediaId)); assertThat(mediaId, is(photoToUpdate.getId())); actualDataSet = getActualDataSet(); mediaTable = actualDataSet.getTable("SC_Gallery_Media"); assertThat(mediaTable.getRowCount(), is(MEDIA_ROW_COUNT)); internalTable = actualDataSet.getTable("SC_Gallery_Internal"); assertThat(internalTable.getRowCount(), is(MEDIA_INTERNAL_ROW_COUNT)); photoTable = actualDataSet.getTable("SC_Gallery_Photo"); assertThat(photoTable.getRowCount(), is(MEDIA_PHOTO_ROW_COUNT)); videoTable = actualDataSet.getTable("SC_Gallery_Video"); assertThat(videoTable.getRowCount(), is(MEDIA_VIDEO_ROW_COUNT)); soundTable = actualDataSet.getTable("SC_Gallery_Sound"); assertThat(soundTable.getRowCount(), is(MEDIA_SOUND_ROW_COUNT)); streamingTable = actualDataSet.getTable("SC_Gallery_Streaming"); assertThat(streamingTable.getRowCount(), is(MEDIA_STREAMING_ROW_COUNT)); pathTable = actualDataSet.getTable("SC_Gallery_Path"); assertThat(pathTable.getRowCount(), is(MEDIA_PATH_ROW_COUNT)); mediaRow = getTableRowFor(mediaTable, "mediaId", mediaIdToUpdate); assertThat(mediaRow.getString("mediaId"), is(mediaIdToUpdate)); assertThat(mediaRow.getString("mediaType"), is(MediaType.Photo.name())); assertThat(mediaRow.getString("instanceId"), is(INSTANCE_A)); assertThat(mediaRow.getString("title"), is("title 2_updated")); assertThat(mediaRow.getString("description"), isEmptyString()); assertThat(mediaRow.getString("author"), isEmptyString()); assertThat(mediaRow.getString("keyword"), is("keywords_updated")); assertThat(mediaRow.getLong("beginVisibilityDate"), is(DateUtil.MINIMUM_DATE.getTime())); assertThat(mediaRow.getLong("endVisibilityDate"), is(endVisibilityDate.getTime())); assertThat(mediaRow.getDate("createDate"), is(CREATE_DATE)); assertThat(mediaRow.getString("createdBy"), is("0")); assertThat(mediaRow.getDate("lastUpdateDate"), greaterThanOrEqualTo(now)); assertThat(mediaRow.getString("lastUpdatedBy"), is(publisherUser.getId())); iMediaRow = getTableRowFor(internalTable, "mediaId", mediaIdToUpdate); assertThat(iMediaRow.getString("mediaId"), is(mediaIdToUpdate)); assertThat(iMediaRow.getString("fileName"), is("fileName_2_updated")); assertThat(iMediaRow.getLong("fileSize"), is(2048L)); assertThat(iMediaRow.getString("fileMimeType"), is("image/tiff")); assertThat(iMediaRow.getInteger("download"), is(1)); assertThat(iMediaRow.getLong("beginDownloadDate"), is(beginDownloadDate.getTime())); assertThat(iMediaRow.getValue("endDownloadDate"), nullValue()); photoRow = getTableRowFor(photoTable, "mediaId", mediaIdToUpdate); assertThat(photoRow.getString("mediaId"), is(mediaIdToUpdate)); assertThat(photoRow.getInteger("resolutionH"), is(100)); assertThat(photoRow.getInteger("resolutionW"), is(200)); } }); }
From source file:com.silverpeas.gallery.dao.MediaDaoTest.java
@Test public void saveNewVideo() throws Exception { performDAOTest(new DAOTest() { @Override// w w w . j a va 2 s . com public void test(final Connection connection) throws Exception { Date now = DateUtil.getNow(); Date beginVisibilityDate = DateUtils.addMonths(now, -1); Date endDownloadDate = DateUtils.addDays(now, 5); Video newVideo = new Video(); newVideo.setComponentInstanceId(INSTANCE_A); newVideo.setTitle("A video title"); newVideo.setAuthor("A video author"); newVideo.setKeyWord("video keywords"); newVideo.setVisibilityPeriod(Period.from(beginVisibilityDate, DateUtil.MAXIMUM_DATE)); newVideo.setFileName("new video file name"); newVideo.setFileSize(2048); newVideo.setFileMimeType(MediaMimeType.MP4); newVideo.setDownloadAuthorized(false); newVideo.setDownloadPeriod(Period.from(DateUtil.MINIMUM_DATE, endDownloadDate)); newVideo.setDefinition(Definition.of(1920, 1080)); assertThat(newVideo.getId(), nullValue()); String newId = MediaDAO.saveMedia(connection, OperationContext.fromUser(writerUser), newVideo); assertThat(newVideo.getId(), notNullValue()); assertThat(newVideo.getId(), is(newId)); IDataSet actualDataSet = getActualDataSet(); ITable mediaTable = actualDataSet.getTable("SC_Gallery_Media"); assertThat(mediaTable.getRowCount(), is(MEDIA_ROW_COUNT + 1)); ITable internalTable = actualDataSet.getTable("SC_Gallery_Internal"); assertThat(internalTable.getRowCount(), is(MEDIA_INTERNAL_ROW_COUNT + 1)); ITable photoTable = actualDataSet.getTable("SC_Gallery_Photo"); assertThat(photoTable.getRowCount(), is(MEDIA_PHOTO_ROW_COUNT)); ITable videoTable = actualDataSet.getTable("SC_Gallery_Video"); assertThat(videoTable.getRowCount(), is(MEDIA_VIDEO_ROW_COUNT + 1)); ITable soundTable = actualDataSet.getTable("SC_Gallery_Sound"); assertThat(soundTable.getRowCount(), is(MEDIA_SOUND_ROW_COUNT)); ITable streamingTable = actualDataSet.getTable("SC_Gallery_Streaming"); assertThat(streamingTable.getRowCount(), is(MEDIA_STREAMING_ROW_COUNT)); ITable pathTable = actualDataSet.getTable("SC_Gallery_Path"); assertThat(pathTable.getRowCount(), is(MEDIA_PATH_ROW_COUNT)); TableRow mediaRow = getTableRowFor(mediaTable, "mediaId", newVideo.getId()); assertThat(mediaRow.getString("mediaId"), is(newId)); assertThat(mediaRow.getString("mediaType"), is(MediaType.Video.name())); assertThat(mediaRow.getString("instanceId"), is(INSTANCE_A)); assertThat(mediaRow.getString("title"), is("A video title")); assertThat(mediaRow.getString("description"), isEmptyString()); assertThat(mediaRow.getString("author"), is("A video author")); assertThat(mediaRow.getString("keyword"), is("video keywords")); assertThat(mediaRow.getLong("beginVisibilityDate"), is(beginVisibilityDate.getTime())); assertThat(mediaRow.getLong("endVisibilityDate"), is(DateUtil.MAXIMUM_DATE.getTime())); assertThat(mediaRow.getDate("createDate"), greaterThanOrEqualTo(now)); assertThat(mediaRow.getString("createdBy"), is(writerUser.getId())); assertThat(mediaRow.getDate("lastUpdateDate"), is(mediaRow.getDate("createDate"))); assertThat(mediaRow.getString("lastUpdatedBy"), is(writerUser.getId())); TableRow iMediaRow = getTableRowFor(internalTable, "mediaId", newVideo.getId()); assertThat(iMediaRow.getString("mediaId"), is(newId)); assertThat(iMediaRow.getString("fileName"), is("new video file name")); assertThat(iMediaRow.getLong("fileSize"), is(2048L)); assertThat(iMediaRow.getString("fileMimeType"), is("video/mp4")); assertThat(iMediaRow.getInteger("download"), is(0)); assertThat(iMediaRow.getLong("beginDownloadDate"), nullValue()); assertThat(iMediaRow.getLong("endDownloadDate"), is(endDownloadDate.getTime())); TableRow videoRow = getTableRowFor(videoTable, "mediaId", newVideo.getId()); assertThat(videoRow.getString("mediaId"), is(newId)); assertThat(videoRow.getInteger("resolutionH"), is(1080)); assertThat(videoRow.getInteger("resolutionW"), is(1920)); assertThat(videoRow.getLong("bitrate"), is(0L)); assertThat(videoRow.getLong("duration"), is(0L)); } }); }