Repository: netty/netty
File: buffer/src/test/java/io/netty5/buffer/api/tests/BufferTestSupport.java (Java)

Code before:
            Buffer base = allocate(bytes.length).writeBytes(bytes).makeReadOnly();
            return () -> base; // Technically off-spec.
        }
    }

    static Stream<Fixture> fixtureCombinations(List<Fixture> initFixtures) {
        Builder<Fixture> builder = Stream.builder();
        initFixtures.forEach(builder);

        // Add 2-way composite buffers of all combinations.
        for (Fixture first : initFixtures) {
            for (Fixture second : initFixtures) {
                builder.add(new Fixture("compose(" + first + ", " + second + ')', () -> {
                    return new TestAllocator() {
                        final BufferAllocator a = first.get();
                        final BufferAllocator b = second.get();
                        @Override
                        public Buffer allocate(int size) {
                            int half = size / 2;
                            try (Buffer firstHalf = a.allocate(half);
                                 Buffer secondHalf = b.allocate(size - half)) {
                                return CompositeBuffer.compose(a, firstHalf.send(), secondHalf.send());
                            }
                        }

                        @Override
                        public boolean isPooling() {
                            return a.isPooling();
                        }

                        @Override
                        public AllocationType getAllocationType() {
                            return a.getAllocationType();
                        }

                        @Override
                        public void close() {
                            a.close();
                            b.close();
                        }
                    };
                }, Fixture.Properties.COMPOSITE));
            }
        }

        // Also add a 3-way composite buffer.
        builder.add(new Fixture("compose(heap,heap,heap)", () -> {
            return new TestAllocator() {
                final BufferAllocator allocator = BufferAllocator.onHeapUnpooled();
                @Override
                public Buffer allocate(int size) {

Review comment (suggestion):
```suggestion
                fiinal Properties[] properties;
```

Code after:
                }
                String managersName = String.valueOf(chars, 0, 2);
                builder.add(new Fixture(f + "/" + managersName,
                                        () -> MemoryManager.using(managers, f), f.getProperties()));
            }
            return builder.build();
        }).collect(Collectors.toList());
        return initFixtures;
    }

    private abstract static class TestAllocator implements BufferAllocator {
        @Override
        public Supplier<Buffer> constBufferSupplier(byte[] bytes) {
            Buffer base = allocate(bytes.length).writeBytes(bytes).makeReadOnly();
            return () -> base; // Technically off-spec.
        }
    }

    static Stream<Fixture> fixtureCombinations(List<Fixture> initFixtures) {
        Builder<Fixture> builder = Stream.builder();
        initFixtures.forEach(builder);

        // Add 2-way composite buffers of all combinations.
        for (Fixture first : initFixtures) {
            for (Fixture second : initFixtures) {
                final Properties[] properties;
                if (first.isUncloseable() || second.isUncloseable()) {
                    properties = new Properties[] { COMPOSITE, UNCLOSEABLE };
                } else {
                    properties = new Properties[] { COMPOSITE };
                }
                builder.add(new Fixture("compose(" + first + ", " + second + ')', () -> {
                    return new TestAllocator() {
                        final BufferAllocator a = first.get();
                        final BufferAllocator b = second.get();
                        @Override
                        public Buffer allocate(int size) {
                            int half = size / 2;
                            try (Buffer firstHalf = a.allocate(half);
                                 Buffer secondHalf = b.allocate(size - half)) {
                                return CompositeBuffer.compose(a, firstHalf.send(), secondHalf.send());
                            }
                        }

                        @Override
                        public boolean isPooling() {
                            return a.isPooling();
                        }

                        @Override
                        public AllocationType getAllocationType() {