@Override
    public void close() {
        if (!sharedYarnClient) {
            yarnClient.stop();
        }
    }
@Test
    void testYarnClientShutDown() {
        YarnClusterDescriptor yarnClusterDescriptor = createYarnClusterDescriptor();

        yarnClusterDescriptor.close();

        assertThat(yarnClient.isInState(Service.STATE.STARTED)).isTrue();

        final YarnClient closableYarnClient = YarnClient.createYarnClient();
        closableYarnClient.init(yarnConfiguration);
        closableYarnClient.start();

        yarnClusterDescriptor =
                YarnTestUtils.createClusterDescriptorWithLogging(
                        temporaryFolder.toFile().getAbsolutePath(),
                        new Configuration(),
                        yarnConfiguration,
                        closableYarnClient,
                        false);

        yarnClusterDescriptor.close();

        assertThat(closableYarnClient.isInState(Service.STATE.STOPPED)).isTrue();
    }