public static HazelcastInstance newHazelcastInstance(Config config) {
        if (config == null) {
            config = Config.load();
        }

        return newHazelcastInstance(
                config,
                config.getInstanceName(),
                new DefaultNodeContext()
        );
    }
@Test(expected = IllegalStateException.class)
    public void test_NewInstance_terminateInstance_afterNodeStart() throws Exception {
        NodeContext context = new TestNodeContext() {
            @Override
            public NodeExtension createNodeExtension(final Node node) {
                NodeExtension nodeExtension = super.createNodeExtension(node);

                doAnswer(invocation -> {
                    node.hazelcastInstance.shutdown();
                    return null;
                }).when(nodeExtension).afterStart();

                return nodeExtension;
            }
        };

        Config config = new Config();
        config.getNetworkConfig().getJoin().getAutoDetectionConfig().setEnabled(false);

        hazelcastInstance = HazelcastInstanceFactory.newHazelcastInstance(config, randomString(), context);
    }