### Question:
AwsEC2Container extends AwsContainer { Runnable autoscalingSelfHealingWrapper (@NotNull Runnable baseMethod) { final AtomicBoolean asgSelfHealingRun = new AtomicBoolean(false); return isNativeAwsAutoscaling() ? () -> { if (asgSelfHealingRun.compareAndSet(false, true)) { log.debug("First self healing attempt will use Autoscaling to recreate"); awsEC2Platform.triggerAutoscalingUnhealthy(instanceId); return; } baseMethod.run(); } : baseMethod; } private  AwsEC2Container(); static AwsEC2ContainerBuilder builder(); String getInstanceId(); String getGroupIdentifier(); String getKeyName(); String getName(); boolean isSSHCapable(); String getImageId(); @Override Platform getPlatform(); @Override boolean eligibleForExperiments(); @Override String getSimpleName(); @Override String getAggregationIdentifier(); @Override DataDogIdentifier getDataDogIdentifier(); @Override boolean isCattle(); @Override boolean supportsShellBasedExperiments(); @ChaosExperiment(experimentType = ExperimentType.STATE) void stopContainer(Experiment experiment); @ChaosExperiment(experimentType = ExperimentType.STATE) void restartContainer(Experiment experiment); @ChaosExperiment(experimentType = ExperimentType.STATE, experimentScope = ExperimentScope.CATTLE) void terminateASGContainer(Experiment experiment); @ChaosExperiment(experimentType = ExperimentType.NETWORK) void removeSecurityGroups(Experiment experiment); String getRoutableAddress(); String getPublicAddress();  }### Answer:
@Test public void autoscalingSelfHealingWrapper () { doReturn(true).when(awsEC2Container).isNativeAwsAutoscaling(); Runnable baseMethod = spy(Runnable.class); Runnable callable = awsEC2Container.autoscalingSelfHealingWrapper(baseMethod); callable.run(); verify(awsEC2Platform, atLeastOnce()).triggerAutoscalingUnhealthy(anyString()); verify(baseMethod, never()).run(); reset(baseMethod, awsEC2Platform); callable.run(); verify(awsEC2Platform, never()).triggerAutoscalingUnhealthy(anyString()); verify(baseMethod, atLeastOnce()).run(); reset(baseMethod, awsEC2Platform); callable = awsEC2Container.autoscalingSelfHealingWrapper(baseMethod); doThrow(new RuntimeException()).when(awsEC2Platform).triggerAutoscalingUnhealthy(anyString()); try { callable.run(); fail("We expect an exception to be thrown for this test."); } catch (RuntimeException expected) { } callable.run(); verify(baseMethod, times(1)).run(); }