@Test
    public void largeFile() throws Exception {
        final HttpFileAttributes attrs = new HttpFileAttributes(5, 0);
        final ResponseHeaders headers = ResponseHeaders.of(200);
        final HttpResponse res = HttpResponse.of("large");
        final AggregatedHttpFile aggregated = AggregatedHttpFile.of(HttpData.ofUtf8("large"), 0);
        final AggregatedHttpFile aggregatedWithPooledObjs = AggregatedHttpFile.of(HttpData.ofUtf8("large"), 0);
        final HttpFile uncached = mock(HttpFile.class);
        when(uncached.readAttributes(executor)).thenReturn(UnmodifiableFuture.completedFuture(attrs));
        when(uncached.readHeaders(executor)).thenReturn(UnmodifiableFuture.completedFuture(headers));
        when(uncached.read(any(), any())).thenReturn(UnmodifiableFuture.completedFuture(res));
        when(uncached.aggregate(any())).thenReturn(UnmodifiableFuture.completedFuture(aggregated));
        when(uncached.aggregateWithPooledObjects(any(), any()))
                .thenReturn(UnmodifiableFuture.completedFuture(aggregatedWithPooledObjs));

        final HttpFile cached = HttpFile.ofCached(uncached, 4);

        // read() should be delegated to 'uncached'.
        assertThat(cached.read(executor, alloc).join()).isSameAs(res);
        verify(uncached, times(1)).readAttributes(executor);
        verify(uncached, times(1)).read(executor, alloc);
        verifyNoMoreInteractions(uncached);
        clearInvocations(uncached);

        // aggregate() should be delegated to 'uncached'.
        assertThat(cached.aggregate(executor).join()).isSameAs(aggregated);
        verify(uncached, times(1)).readAttributes(executor);
        verify(uncached, times(1)).aggregate(executor);
        verifyNoMoreInteractions(uncached);
        clearInvocations(uncached);

        // aggregateWithPooledObjects() should be delegated to 'uncached'.
        assertThat(cached.aggregateWithPooledObjects(executor, alloc).join())
                .isSameAs(aggregatedWithPooledObjs);
        verify(uncached, times(1)).readAttributes(executor);
        verify(uncached, times(1)).aggregateWithPooledObjects(executor, alloc);
        verifyNoMoreInteractions(uncached);
        clearInvocations(uncached);
    }
Makes sure a large file is not cached.
core/src/test/java/com/linecorp/armeria/server/file/CachingHttpFileTest.java