### Question:
ClusterDecorator { @Measure(ClusterDecorator.class) public Cluster decorate(@Nonnull Cluster cluster, @Nonnull ClusterV4Request request, Blueprint blueprint, User user, Workspace workspace, @Nonnull Stack stack, String parentEnvironmentCloudPlatform) { prepareBlueprint(cluster, request, workspace, stack, Optional.ofNullable(blueprint), user); prepareClusterManagerVariant(cluster); validateBlueprintIfRequired(cluster, request, stack); prepareRds(cluster, request, stack); prepareAutoTlsFlag(cluster, request, stack, parentEnvironmentCloudPlatform); cluster = sharedServiceConfigProvider.configureCluster(cluster, user, workspace); return cluster; }  @Measure(ClusterDecorator.class) Cluster decorate(@Nonnull Cluster cluster, @Nonnull ClusterV4Request request, Blueprint blueprint, User user, Workspace workspace,
            @Nonnull Stack stack, String parentEnvironmentCloudPlatform);  }### Answer:
@Test void testDecorateIfMethodCalledThenSharedServiceConfigProviderShouldBeCalledOnceToConfigureTheCluster() { Cluster expectedClusterInstance = new Cluster(); Blueprint blueprint = getBlueprint(); when(sharedServiceConfigProvider.configureCluster(any(Cluster.class), any(User.class), any(Workspace.class))) .thenReturn(expectedClusterInstance); Cluster result = underTest.decorate(expectedClusterInstance, createClusterV4Request(), blueprint, user, new Workspace(), stack, null); assertEquals(expectedClusterInstance, result); verify(sharedServiceConfigProvider, times(1)).configureCluster(any(Cluster.class), any(User.class), any(Workspace.class)); }
@Test void testAutoTlsSettingByParentEnvironmentCloudPlatform() { Cluster expectedClusterInstance = new Cluster(); Blueprint blueprint = getBlueprint(); when(sharedServiceConfigProvider.configureCluster(any(Cluster.class), any(User.class), any(Workspace.class))) .thenReturn(expectedClusterInstance); ArgumentCaptor<Platform> platformArgumentCaptor = ArgumentCaptor.forClass(Platform.class); when(cloudPlatformConnectors.get(platformArgumentCaptor.capture(), any())).thenReturn(connector); String platform = CloudPlatform.YARN.name(); underTest.decorate(expectedClusterInstance, createClusterV4Request(), blueprint, user, new Workspace(), stack, platform); assertEquals(platform, platformArgumentCaptor.getValue().value()); }