### Question:
MappedFileQueue { public long getMappedMemorySize() { long size = 0; Object[] mfs = this.copyMappedFiles(0); if (mfs != null) { for (Object mf : mfs) { if (((ReferenceResource) mf).isAvailable()) { size += this.mappedFileSize; } } } return size; } MappedFileQueue(final String storePath, int mappedFileSize,
        AllocateMappedFileService allocateMappedFileService); void checkSelf(); MappedFile getMappedFileByTime(final long timestamp); void truncateDirtyFiles(long offset); void backupFiles(long offset, String backupPath); boolean load(); long howMuchFallBehind(); MappedFile getLastMappedFile(final long startOffset, boolean needCreate); MappedFile getLastMappedFile(final long startOffset); MappedFile getLastMappedFile(); boolean resetOffset(long offset); long getMinOffset(); long getMaxOffset(); long getMaxWrotePosition(); long remainHowManyDataToCommit(); long remainHowManyDataToFlush(); void deleteLastMappedFile(); int deleteExpiredFileByTime(final long expiredTime,
        final int deleteFilesInterval,
        final long intervalForcibly,
        final boolean cleanImmediately); int deleteExpiredFileByOffset(long offset, int unitSize); boolean flush(final int flushLeastPages); boolean commit(final int commitLeastPages); MappedFile findMappedFileByOffset(final long offset, final boolean returnFirstOnNotFound); MappedFile getFirstMappedFile(); MappedFile findMappedFileByOffset(final long offset); long getMappedMemorySize(); boolean retryDeleteFirstFile(final long intervalForcibly); void shutdown(final long intervalForcibly); void destroy(); long getFlushedWhere(); void setFlushedWhere(long flushedWhere); long getStoreTimestamp(); List<MappedFile> getMappedFiles(); int getMappedFileSize(); long getCommittedWhere(); void setCommittedWhere(final long committedWhere);  }### Answer:
@Test public void testGetMappedMemorySize() { final String fixedMsg = "abcd"; MappedFileQueue mappedFileQueue = new MappedFileQueue("target/unit_test_store/d/", 1024, null); for (int i = 0; i < 1024; i++) { MappedFile mappedFile = mappedFileQueue.getLastMappedFile(0); assertThat(mappedFile).isNotNull(); assertThat(mappedFile.appendMessage(fixedMsg.getBytes())).isTrue(); } assertThat(mappedFileQueue.getMappedMemorySize()).isEqualTo(fixedMsg.length() * 1024); mappedFileQueue.shutdown(1000); mappedFileQueue.destroy(); }