PatientDataJPADao extends AbstractPLCEntityDao<PatientData> implements PatientDataDao { @Override public long normalizeFileSize(long size) { long normalizedSize; if (size / FileUtils.ONE_TB > 0) { normalizedSize = size / FileUtils.ONE_TB; } else if (size / FileUtils.ONE_GB > 0) { normalizedSize = size / FileUtils.ONE_GB; } else if (size / FileUtils.ONE_MB > 0) { normalizedSize = size / FileUtils.ONE_MB; } else if (size / FileUtils.ONE_KB > 0) { normalizedSize = size / FileUtils.ONE_KB; } else { normalizedSize = size; } return normalizedSize; } @Inject  PatientDataJPADao(EntityManager em); @SuppressWarnings("unchecked") @Transactional List<PatientData> getByAccountId(Long id); @Transactional @Override Summary getPatientDataSummary(Filter filter); @SuppressWarnings("unchecked") @Override List<FileInfo> getPatientData(Filter filter); @Override long normalizeFileSize(long size);  }
@Test public void normalizeFileSize() { assertEquals(1, getTestDao().normalizeFileSize(1L)); assertEquals(1, getTestDao().normalizeFileSize(1025)); assertEquals(1, getTestDao().normalizeFileSize(1025 * 1024)); assertEquals(1, getTestDao().normalizeFileSize(1025 * 1024 * 1024)); assertEquals(1, getTestDao().normalizeFileSize(1025 * 1024 * 1024 * 1024)); }