Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Forfend committed Sep 25, 2024
1 parent f553263 commit 49bd3d0
Showing 1 changed file with 24 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
/*
* Copyright 2013-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.awspring.cloud.autoconfigure.config.parameterstore;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;

import io.awspring.cloud.autoconfigure.core.AwsAutoConfiguration;
import io.awspring.cloud.autoconfigure.core.CredentialsProviderAutoConfiguration;
import io.awspring.cloud.autoconfigure.core.RegionProviderAutoConfiguration;
Expand All @@ -11,30 +29,27 @@
import org.springframework.context.annotation.Bean;
import software.amazon.awssdk.services.ssm.SsmClient;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;

/**
* Tests for {@link ParameterStoreAutoConfiguration}
*/
class ParameterStoreAutoConfigurationTest {

private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
.withPropertyValues("spring.cloud.aws.region.static:eu-west-1")
.withConfiguration(AutoConfigurations.of(RegionProviderAutoConfiguration.class,
CredentialsProviderAutoConfiguration.class, ParameterStoreAutoConfiguration.class,
AwsAutoConfiguration.class));
.withPropertyValues("spring.cloud.aws.region.static:eu-west-1")
.withConfiguration(AutoConfigurations.of(RegionProviderAutoConfiguration.class,
CredentialsProviderAutoConfiguration.class, ParameterStoreAutoConfiguration.class,
AwsAutoConfiguration.class));

@Test
void parameterStoreAutoConfigurationIsDisabled() {
this.contextRunner.withPropertyValues("spring.cloud.aws.parameterstore.enabled:false")
.run(context -> assertThat(context).doesNotHaveBean(SsmClient.class));
.run(context -> assertThat(context).doesNotHaveBean(SsmClient.class));
}

@Test
void parameterStoreAutoConfigurationIsEnabled() {
this.contextRunner.withPropertyValues("spring.cloud.aws.parameterstore.enabled:true")
.run(context -> assertThat(context).hasSingleBean(SsmClient.class));
.run(context -> assertThat(context).hasSingleBean(SsmClient.class));
}

@Test
Expand Down

0 comments on commit 49bd3d0

Please sign in to comment.