@Override
    public void setOutputBuffers(OutputBuffers newOutputBuffers)
    {
        requireNonNull(newOutputBuffers, "newOutputBuffers is null");
        checkArgument(outputBuffers.getType() == SPOOLING, "Invalid output buffers type");
        checkArgument(outputBuffers.isNoMoreBufferIds(), "invalid noMoreBufferIds");

        if (state.get().isTerminal() || outputBuffers.getVersion() >= newOutputBuffers.getVersion()) {
            return;
        }

        outputBuffers.checkValidTransition(newOutputBuffers);
    }
@Test
    public void testSetOutputBuffers()
    {
        SpoolingOutputBuffer buffer = createSpoolingOutputBuffer();

        OutputBuffers newBuffers = new OutputBuffers(SPOOLING, 1, true, ImmutableMap.of());
        buffer.setOutputBuffers(newBuffers);

        OutputBuffers invalidBuffers = new OutputBuffers(PARTITIONED, 1, true, ImmutableMap.of());
        try {
            buffer.setOutputBuffers(invalidBuffers);
        }
        catch (IllegalArgumentException e) {
            assertEquals(e.getMessage(), "Invalid output buffers type");
        }
    }