@Override
    public void setRuntimeContext(RuntimeContext context) {
        super.setRuntimeContext(context);
        if (format instanceof RichOutputFormat) {
            ((RichOutputFormat) format).setRuntimeContext(context);
        }
    }
@Test
    void setRuntimeContext() {
        RuntimeContext mockRuntimeContext = Mockito.mock(RuntimeContext.class);

        // Make sure setRuntimeContext of the rich output format is called
        RichOutputFormat<?> mockRichOutputFormat = Mockito.mock(RichOutputFormat.class);
        new OutputFormatSinkFunction<>(mockRichOutputFormat).setRuntimeContext(mockRuntimeContext);
        Mockito.verify(mockRichOutputFormat, Mockito.times(1))
                .setRuntimeContext(Mockito.eq(mockRuntimeContext));

        // Make sure setRuntimeContext work well when output format is not RichOutputFormat
        OutputFormat<?> mockOutputFormat = Mockito.mock(OutputFormat.class);
        new OutputFormatSinkFunction<>(mockOutputFormat).setRuntimeContext(mockRuntimeContext);
    }