public static EsSinkContext mock(BufferQueue<EsIndexRequest> dispatchQueue) throws Exception {
        PowerMockito.mockStatic(MetricRegister.class);
        PowerMockito.doNothing().when(MetricRegister.class, "register", any());
        Context context = CommonPropertiesHolder.getContext();
        String sinkName = CommonPropertiesHolder.getClusterId() + "Sink";
        context.put("taskName", "sid_es_es-rmrv7g7a_v3");
        Channel channel = new BufferQueueChannel();
        EsSinkContext esSinkContext = new EsSinkContext(sinkName, context, channel, dispatchQueue);
        esSinkContext.reload();
        return esSinkContext;
    }
mock

@param dispatchQueue
@return EsSinkContext
@throws Exception exception
inlong-sort-standalone/sort-standalone-source/src/test/java/org/apache/inlong/sort/standalone/sink/elasticsearch/TestEsSinkContext.java