### Question:
MemoryPagesStore { public synchronized void cleanUp(Set<Long> activeTableIds) { if (activeTableIds.isEmpty()) { return; } long latestTableId = Collections.max(activeTableIds); for (Iterator<Map.Entry<Long, TableData>> tableDataIterator = tables.entrySet().iterator(); tableDataIterator.hasNext(); ) { Map.Entry<Long, TableData> tablePagesEntry = tableDataIterator.next(); Long tableId = tablePagesEntry.getKey(); if (tableId < latestTableId && !activeTableIds.contains(tableId)) { for (Page removedPage : tablePagesEntry.getValue().getPages()) { currentBytes -= removedPage.getRetainedSizeInBytes(); } tableDataIterator.remove(); } } } @Inject  MemoryPagesStore(MemoryConfig config); synchronized void initialize(long tableId); synchronized void add(Long tableId, Page page); synchronized List<Page> getPages(
            Long tableId,
            int partNumber,
            int totalParts,
            List<Integer> columnIndexes,
            long expectedRows,
            OptionalLong limit,
            OptionalDouble sampleRatio); synchronized boolean contains(Long tableId); synchronized void cleanUp(Set<Long> activeTableIds);  }### Answer:
@Test public void testCleanUp() { createTable(0L, 0L); createTable(1L, 0L, 1L); createTable(2L, 0L, 1L, 2L); assertTrue(pagesStore.contains(0L)); assertTrue(pagesStore.contains(1L)); assertTrue(pagesStore.contains(2L)); insertToTable(1L, 0L, 1L); assertTrue(pagesStore.contains(0L)); assertTrue(pagesStore.contains(1L)); assertTrue(pagesStore.contains(2L)); insertToTable(2L, 0L, 2L); assertTrue(pagesStore.contains(0L)); assertFalse(pagesStore.contains(1L)); assertTrue(pagesStore.contains(2L)); }