mirror of
https://gitee.com/dcren/initializr.git
synced 2025-07-15 14:04:30 +08:00
Polish migration to JUnit5
See gh-802
This commit is contained in:
parent
8ec763e0ba
commit
2b6ab498cf
@ -37,11 +37,10 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*/
|
||||
@ActiveProfiles("test-default")
|
||||
@SpringBootTest(classes = Config.class, webEnvironment = WebEnvironment.RANDOM_PORT, properties = "management.endpoints.web.exposure.include=info,metrics")
|
||||
public class ActuatorIntegrationTests
|
||||
extends AbstractFullStackInitializrIntegrationTests {
|
||||
class ActuatorIntegrationTests extends AbstractFullStackInitializrIntegrationTests {
|
||||
|
||||
@Test
|
||||
public void infoHasExternalProperties() {
|
||||
void infoHasExternalProperties() {
|
||||
String body = getRestTemplate().getForObject(createUrl("/actuator/info"),
|
||||
String.class);
|
||||
assertThat(body).contains("\"spring-boot\"");
|
||||
@ -49,7 +48,7 @@ public class ActuatorIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void metricsAreRegistered() {
|
||||
void metricsAreRegistered() {
|
||||
downloadZip("/starter.zip?packaging=jar&javaVersion=1.8&style=web&style=jpa");
|
||||
JsonNode result = metricsEndpoint();
|
||||
JsonNode names = result.get("names");
|
||||
|
@ -33,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*
|
||||
* @author Madhura Bhave
|
||||
*/
|
||||
public class InitializrActuatorEndpointsAutoConfigurationTests {
|
||||
class InitializrActuatorEndpointsAutoConfigurationTests {
|
||||
|
||||
private ApplicationContextRunner contextRunner = new ApplicationContextRunner()
|
||||
.withConfiguration(AutoConfigurations.of(JacksonAutoConfiguration.class,
|
||||
@ -42,13 +42,13 @@ public class InitializrActuatorEndpointsAutoConfigurationTests {
|
||||
InitializrActuatorEndpointsAutoConfiguration.class));
|
||||
|
||||
@Test
|
||||
public void autoConfigRegistersBomRangesInfoContributor() {
|
||||
void autoConfigRegistersBomRangesInfoContributor() {
|
||||
this.contextRunner.run((context) -> assertThat(context)
|
||||
.hasSingleBean(BomRangesInfoContributor.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void autoConfigRegistersDependencyRangesInfoContributor() {
|
||||
void autoConfigRegistersDependencyRangesInfoContributor() {
|
||||
this.contextRunner.run((context) -> assertThat(context)
|
||||
.hasSingleBean(DependencyRangesInfoContributor.class));
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*
|
||||
* @author Madhura Bhave
|
||||
*/
|
||||
public class InitializrMetricsAutoConfigurationTests {
|
||||
class InitializrMetricsAutoConfigurationTests {
|
||||
|
||||
private ApplicationContextRunner contextRunner = new ApplicationContextRunner()
|
||||
.withConfiguration(AutoConfigurations.of(MetricsAutoConfiguration.class,
|
||||
@ -41,13 +41,13 @@ public class InitializrMetricsAutoConfigurationTests {
|
||||
InitializrMetricsAutoConfiguration.class));
|
||||
|
||||
@Test
|
||||
public void autoConfigRegistersProjectGenerationMetricsListenerBean() {
|
||||
void autoConfigRegistersProjectGenerationMetricsListenerBean() {
|
||||
this.contextRunner.run((context) -> assertThat(context)
|
||||
.hasSingleBean(ProjectGenerationMetricsListener.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void autoConfigConditionalOnMeterRegistryClass() {
|
||||
void autoConfigConditionalOnMeterRegistryClass() {
|
||||
this.contextRunner.withClassLoader(new FilteredClassLoader(MeterRegistry.class))
|
||||
.run((context) -> assertThat(context)
|
||||
.doesNotHaveBean(ProjectGenerationMetricsListener.class));
|
||||
|
@ -45,7 +45,7 @@ import static org.mockito.Mockito.mock;
|
||||
* @author Stephane Nicoll
|
||||
* @author Madhura Bhave
|
||||
*/
|
||||
public class InitializrStatsAutoConfigurationTests {
|
||||
class InitializrStatsAutoConfigurationTests {
|
||||
|
||||
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
|
||||
.withConfiguration(AutoConfigurations.of(JacksonAutoConfiguration.class,
|
||||
@ -54,7 +54,7 @@ public class InitializrStatsAutoConfigurationTests {
|
||||
InitializrStatsAutoConfiguration.class));
|
||||
|
||||
@Test
|
||||
public void autoConfigRegistersProjectGenerationStatPublisher() {
|
||||
void autoConfigRegistersProjectGenerationStatPublisher() {
|
||||
this.contextRunner
|
||||
.withPropertyValues("initializr.stats.elastic.uri=http://localhost:9200")
|
||||
.run((context) -> assertThat(context)
|
||||
@ -62,14 +62,14 @@ public class InitializrStatsAutoConfigurationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void autoConfigRegistersRetryTemplate() {
|
||||
void autoConfigRegistersRetryTemplate() {
|
||||
this.contextRunner
|
||||
.withPropertyValues("initializr.stats.elastic.uri=http://localhost:9200")
|
||||
.run((context) -> assertThat(context).hasSingleBean(RetryTemplate.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void statsRetryTemplateConditionalOnMissingBean() {
|
||||
void statsRetryTemplateConditionalOnMissingBean() {
|
||||
this.contextRunner
|
||||
.withUserConfiguration(CustomStatsRetryTemplateConfiguration.class)
|
||||
.withPropertyValues("initializr.stats.elastic.uri=http://localhost:9200")
|
||||
@ -83,7 +83,7 @@ public class InitializrStatsAutoConfigurationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void customRestTemplateBuilderIsUsed() {
|
||||
void customRestTemplateBuilderIsUsed() {
|
||||
this.contextRunner.withUserConfiguration(CustomRestTemplateConfiguration.class)
|
||||
.withPropertyValues("initializr.stats.elastic.uri=http://localhost:9200")
|
||||
.run((context) -> {
|
||||
|
@ -34,10 +34,10 @@ import static org.assertj.core.api.Assertions.entry;
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class BomRangesInfoContributorTests {
|
||||
class BomRangesInfoContributorTests {
|
||||
|
||||
@Test
|
||||
public void noBom() {
|
||||
void noBom() {
|
||||
InitializrMetadata metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||
.build();
|
||||
Info info = getInfo(metadata);
|
||||
@ -45,7 +45,7 @@ public class BomRangesInfoContributorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void noMapping() {
|
||||
void noMapping() {
|
||||
BillOfMaterials bom = BillOfMaterials.create("com.example", "bom", "1.0.0");
|
||||
InitializrMetadata metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||
.addBom("foo", bom).build();
|
||||
@ -54,7 +54,7 @@ public class BomRangesInfoContributorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withMappings() {
|
||||
void withMappings() {
|
||||
BillOfMaterials bom = BillOfMaterials.create("com.example", "bom", "1.0.0");
|
||||
bom.getMappings().add(
|
||||
BillOfMaterials.Mapping.create("[1.3.0.RELEASE,1.3.8.RELEASE]", "1.1.0"));
|
||||
|
@ -35,10 +35,10 @@ import static org.assertj.core.api.Assertions.entry;
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class DependencyRangesInfoContributorTests {
|
||||
class DependencyRangesInfoContributorTests {
|
||||
|
||||
@Test
|
||||
public void noDependencyWithVersion() {
|
||||
void noDependencyWithVersion() {
|
||||
InitializrMetadata metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||
.build();
|
||||
Info info = getInfo(metadata);
|
||||
@ -46,7 +46,7 @@ public class DependencyRangesInfoContributorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void dependencyWithNoMapping() {
|
||||
void dependencyWithNoMapping() {
|
||||
Dependency dependency = Dependency.withId("foo", "com.example", "foo",
|
||||
"1.2.3.RELEASE");
|
||||
InitializrMetadata metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||
@ -56,7 +56,7 @@ public class DependencyRangesInfoContributorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void dependencyWithRangeOnArtifact() {
|
||||
void dependencyWithRangeOnArtifact() {
|
||||
Dependency dependency = Dependency.withId("foo", "com.example", "foo",
|
||||
"1.2.3.RELEASE");
|
||||
dependency.getMappings().add(Dependency.Mapping
|
||||
@ -68,7 +68,7 @@ public class DependencyRangesInfoContributorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void dependencyWithRangeAndBom() {
|
||||
void dependencyWithRangeAndBom() {
|
||||
BillOfMaterials bom = BillOfMaterials.create("com.example", "bom", "1.0.0");
|
||||
Dependency dependency = Dependency.withId("foo", "com.example", "foo",
|
||||
"1.2.3.RELEASE");
|
||||
@ -82,7 +82,7 @@ public class DependencyRangesInfoContributorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void dependencyNoMappingSimpleRange() {
|
||||
void dependencyNoMappingSimpleRange() {
|
||||
Dependency dependency = Dependency.withId("foo", "com.example", "foo",
|
||||
"1.2.3.RELEASE");
|
||||
dependency.setVersionRange("[1.1.0.RELEASE, 1.5.0.RELEASE)");
|
||||
@ -101,7 +101,7 @@ public class DependencyRangesInfoContributorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void dependencyWithMappingAndOpenRange() {
|
||||
void dependencyWithMappingAndOpenRange() {
|
||||
Dependency dependency = Dependency.withId("foo", null, null, "0.3.0.RELEASE");
|
||||
dependency.getMappings().add(Dependency.Mapping
|
||||
.create("[1.1.0.RELEASE, 1.2.0.RELEASE)", null, null, "0.1.0.RELEASE"));
|
||||
@ -118,7 +118,7 @@ public class DependencyRangesInfoContributorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void dependencyWithMappingAndNoOpenRange() {
|
||||
void dependencyWithMappingAndNoOpenRange() {
|
||||
Dependency dependency = Dependency.withId("foo", null, null, "0.3.0.RELEASE");
|
||||
dependency.getMappings().add(Dependency.Mapping
|
||||
.create("[1.1.0.RELEASE, 1.2.0.RELEASE)", null, null, "0.1.0.RELEASE"));
|
||||
|
@ -32,7 +32,7 @@ import org.junit.jupiter.api.Test;
|
||||
/**
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class ProjectGenerationMetricsListenerTests {
|
||||
class ProjectGenerationMetricsListenerTests {
|
||||
|
||||
private InitializrMetadata metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||
.addDependencyGroup("core", "web", "security", "spring-data").build();
|
||||
@ -49,7 +49,7 @@ public class ProjectGenerationMetricsListenerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void projectGenerationCount() {
|
||||
void projectGenerationCount() {
|
||||
ProjectRequest request = initialize();
|
||||
request.resolve(this.metadata);
|
||||
fireProjectGeneratedEvent(request);
|
||||
@ -57,7 +57,7 @@ public class ProjectGenerationMetricsListenerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void projectGenerationCountWithFailure() {
|
||||
void projectGenerationCountWithFailure() {
|
||||
ProjectRequest request = initialize();
|
||||
request.resolve(this.metadata);
|
||||
fireProjectFailedEvent(request);
|
||||
@ -66,7 +66,7 @@ public class ProjectGenerationMetricsListenerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void dependencies() {
|
||||
void dependencies() {
|
||||
ProjectRequest request = initialize();
|
||||
request.getStyle().addAll(Arrays.asList("security", "spring-data"));
|
||||
request.resolve(this.metadata);
|
||||
@ -76,7 +76,7 @@ public class ProjectGenerationMetricsListenerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void noDependencies() {
|
||||
void noDependencies() {
|
||||
ProjectRequest request = initialize();
|
||||
request.resolve(this.metadata);
|
||||
fireProjectGeneratedEvent(request);
|
||||
@ -84,7 +84,7 @@ public class ProjectGenerationMetricsListenerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolvedWebDependency() {
|
||||
void resolvedWebDependency() {
|
||||
ProjectRequest request = initialize();
|
||||
request.getStyle().add("spring-data");
|
||||
request.setPackaging("war");
|
||||
@ -95,7 +95,7 @@ public class ProjectGenerationMetricsListenerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void aliasedDependencyUseStandardId() {
|
||||
void aliasedDependencyUseStandardId() {
|
||||
Dependency dependency = new Dependency();
|
||||
dependency.setId("foo");
|
||||
dependency.getAliases().add("foo-old");
|
||||
@ -111,7 +111,7 @@ public class ProjectGenerationMetricsListenerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void defaultType() {
|
||||
void defaultType() {
|
||||
ProjectRequest request = initialize();
|
||||
request.resolve(this.metadata);
|
||||
fireProjectGeneratedEvent(request);
|
||||
@ -119,7 +119,7 @@ public class ProjectGenerationMetricsListenerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void explicitType() {
|
||||
void explicitType() {
|
||||
ProjectRequest request = initialize();
|
||||
request.setType("gradle-build");
|
||||
request.resolve(this.metadata);
|
||||
@ -128,7 +128,7 @@ public class ProjectGenerationMetricsListenerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void defaultPackaging() {
|
||||
void defaultPackaging() {
|
||||
ProjectRequest request = initialize();
|
||||
request.resolve(this.metadata);
|
||||
fireProjectGeneratedEvent(request);
|
||||
@ -136,7 +136,7 @@ public class ProjectGenerationMetricsListenerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void explicitPackaging() {
|
||||
void explicitPackaging() {
|
||||
ProjectRequest request = initialize();
|
||||
request.setPackaging("war");
|
||||
request.resolve(this.metadata);
|
||||
@ -145,7 +145,7 @@ public class ProjectGenerationMetricsListenerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void defaultJavaVersion() {
|
||||
void defaultJavaVersion() {
|
||||
ProjectRequest request = initialize();
|
||||
request.resolve(this.metadata);
|
||||
fireProjectGeneratedEvent(request);
|
||||
@ -153,7 +153,7 @@ public class ProjectGenerationMetricsListenerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void explicitJavaVersion() {
|
||||
void explicitJavaVersion() {
|
||||
ProjectRequest request = initialize();
|
||||
request.setJavaVersion("1.7");
|
||||
request.resolve(this.metadata);
|
||||
@ -162,7 +162,7 @@ public class ProjectGenerationMetricsListenerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void defaultLanguage() {
|
||||
void defaultLanguage() {
|
||||
ProjectRequest request = initialize();
|
||||
request.resolve(this.metadata);
|
||||
fireProjectGeneratedEvent(request);
|
||||
@ -170,7 +170,7 @@ public class ProjectGenerationMetricsListenerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void explicitGroovyLanguage() {
|
||||
void explicitGroovyLanguage() {
|
||||
ProjectRequest request = initialize();
|
||||
request.setLanguage("groovy");
|
||||
request.resolve(this.metadata);
|
||||
@ -179,7 +179,7 @@ public class ProjectGenerationMetricsListenerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void explicitKotlinLanguage() {
|
||||
void explicitKotlinLanguage() {
|
||||
ProjectRequest request = initialize();
|
||||
request.setLanguage("kotlin");
|
||||
request.resolve(this.metadata);
|
||||
@ -188,7 +188,7 @@ public class ProjectGenerationMetricsListenerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void defaultBootVersion() {
|
||||
void defaultBootVersion() {
|
||||
ProjectRequest request = initialize();
|
||||
request.resolve(this.metadata);
|
||||
fireProjectGeneratedEvent(request);
|
||||
@ -196,7 +196,7 @@ public class ProjectGenerationMetricsListenerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void explicitBootVersion() {
|
||||
void explicitBootVersion() {
|
||||
ProjectRequest request = initialize();
|
||||
request.setBootVersion("1.5.17.RELEASE");
|
||||
request.resolve(this.metadata);
|
||||
@ -205,7 +205,7 @@ public class ProjectGenerationMetricsListenerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void userAgentAvailable() {
|
||||
void userAgentAvailable() {
|
||||
ProjectRequest request = initialize();
|
||||
request.getParameters().put("user-agent", "HTTPie/0.9.2");
|
||||
request.resolve(this.metadata);
|
||||
@ -214,7 +214,7 @@ public class ProjectGenerationMetricsListenerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void collectAllMetrics() {
|
||||
void collectAllMetrics() {
|
||||
ProjectRequest request = initialize();
|
||||
request.getStyle().addAll(Arrays.asList("web", "security"));
|
||||
request.setType("gradle-project");
|
||||
@ -234,7 +234,7 @@ public class ProjectGenerationMetricsListenerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void incrementMetrics() {
|
||||
void incrementMetrics() {
|
||||
ProjectRequest request = initialize();
|
||||
request.getStyle().addAll(Arrays.asList("security", "spring-data"));
|
||||
request.resolve(this.metadata);
|
||||
|
@ -47,7 +47,7 @@ import static org.assertj.core.api.Assertions.fail;
|
||||
*/
|
||||
@Import(StatsMockController.class)
|
||||
@ActiveProfiles({ "test-default", "test-custom-stats" })
|
||||
public class MainControllerStatsIntegrationTests
|
||||
class MainControllerStatsIntegrationTests
|
||||
extends AbstractFullStackInitializrIntegrationTests {
|
||||
|
||||
@Autowired
|
||||
@ -65,7 +65,7 @@ public class MainControllerStatsIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void simpleProject() {
|
||||
void simpleProject() {
|
||||
downloadArchive("/starter.zip?groupId=com.foo&artifactId=bar&dependencies=web");
|
||||
assertThat(this.statsMockController.stats).as("No stat got generated").hasSize(1);
|
||||
StatsMockController.Content content = this.statsMockController.stats.get(0);
|
||||
@ -79,7 +79,7 @@ public class MainControllerStatsIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void authorizationHeaderIsSet() {
|
||||
void authorizationHeaderIsSet() {
|
||||
downloadArchive("/starter.zip");
|
||||
assertThat(this.statsMockController.stats).as("No stat got generated").hasSize(1);
|
||||
StatsMockController.Content content = this.statsMockController.stats.get(0);
|
||||
@ -94,7 +94,7 @@ public class MainControllerStatsIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void requestIpNotSetByDefault() {
|
||||
void requestIpNotSetByDefault() {
|
||||
downloadArchive("/starter.zip?groupId=com.foo&artifactId=bar&dependencies=web");
|
||||
assertThat(this.statsMockController.stats).as("No stat got generated").hasSize(1);
|
||||
StatsMockController.Content content = this.statsMockController.stats.get(0);
|
||||
@ -105,7 +105,7 @@ public class MainControllerStatsIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void requestIpIsSetWhenHeaderIsPresent() throws Exception {
|
||||
void requestIpIsSetWhenHeaderIsPresent() throws Exception {
|
||||
RequestEntity<?> request = RequestEntity.get(new URI(createUrl("/starter.zip")))
|
||||
.header("X-FORWARDED-FOR", "10.0.0.123").build();
|
||||
getRestTemplate().exchange(request, String.class);
|
||||
@ -118,7 +118,7 @@ public class MainControllerStatsIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void requestIpv4IsNotSetWhenHeaderHasGarbage() throws Exception {
|
||||
void requestIpv4IsNotSetWhenHeaderHasGarbage() throws Exception {
|
||||
RequestEntity<?> request = RequestEntity.get(new URI(createUrl("/starter.zip")))
|
||||
.header("x-forwarded-for", "foo-bar").build();
|
||||
getRestTemplate().exchange(request, String.class);
|
||||
@ -132,7 +132,7 @@ public class MainControllerStatsIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void requestCountryIsNotSetWhenHeaderIsSetToXX() throws Exception {
|
||||
void requestCountryIsNotSetWhenHeaderIsSetToXX() throws Exception {
|
||||
RequestEntity<?> request = RequestEntity.get(new URI(createUrl("/starter.zip")))
|
||||
.header("cf-ipcountry", "XX").build();
|
||||
getRestTemplate().exchange(request, String.class);
|
||||
@ -146,7 +146,7 @@ public class MainControllerStatsIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void invalidProjectSillHasStats() {
|
||||
void invalidProjectSillHasStats() {
|
||||
try {
|
||||
downloadArchive("/starter.zip?type=invalid-type");
|
||||
fail("Should have failed to generate project with invalid type");
|
||||
@ -167,7 +167,7 @@ public class MainControllerStatsIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void errorPublishingStatsDoesNotBubbleUp() {
|
||||
void errorPublishingStatsDoesNotBubbleUp() {
|
||||
this.projectGenerationStatPublisher.updateRequestUrl(
|
||||
URI.create("http://localhost:" + this.port + "/elastic-error"));
|
||||
downloadArchive("/starter.zip");
|
||||
|
@ -46,7 +46,7 @@ import static org.springframework.test.web.client.response.MockRestResponseCreat
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class ProjectGenerationStatPublisherTests extends AbstractInitializrStatTests {
|
||||
class ProjectGenerationStatPublisherTests extends AbstractInitializrStatTests {
|
||||
|
||||
private RetryTemplate retryTemplate;
|
||||
|
||||
@ -70,7 +70,7 @@ public class ProjectGenerationStatPublisherTests extends AbstractInitializrStatT
|
||||
}
|
||||
|
||||
@Test
|
||||
public void publishDocumentWithUserNameAndPassword() {
|
||||
void publishDocumentWithUserNameAndPassword() {
|
||||
StatsProperties properties = new StatsProperties();
|
||||
properties.getElastic().setUri("http://example.com/elastic");
|
||||
properties.getElastic().setUsername("foo");
|
||||
@ -81,7 +81,7 @@ public class ProjectGenerationStatPublisherTests extends AbstractInitializrStatT
|
||||
}
|
||||
|
||||
@Test
|
||||
public void publishDocumentWithUserInfo() {
|
||||
void publishDocumentWithUserInfo() {
|
||||
StatsProperties properties = new StatsProperties();
|
||||
properties.getElastic().setUri("https://elastic:secret@es.example.com");
|
||||
configureService(properties);
|
||||
@ -90,7 +90,7 @@ public class ProjectGenerationStatPublisherTests extends AbstractInitializrStatT
|
||||
}
|
||||
|
||||
@Test
|
||||
public void publishDocumentWithUserInfoOverridesUserNamePassword() {
|
||||
void publishDocumentWithUserInfoOverridesUserNamePassword() {
|
||||
StatsProperties properties = new StatsProperties();
|
||||
properties.getElastic().setUri("https://elastic:secret@es.example.com");
|
||||
properties.getElastic().setUsername("another");
|
||||
@ -101,7 +101,7 @@ public class ProjectGenerationStatPublisherTests extends AbstractInitializrStatT
|
||||
}
|
||||
|
||||
@Test
|
||||
public void publishDocumentWithNoAuthentication() {
|
||||
void publishDocumentWithNoAuthentication() {
|
||||
StatsProperties properties = new StatsProperties();
|
||||
properties.getElastic().setUri("https://example.com/test/");
|
||||
configureService(properties);
|
||||
@ -125,7 +125,7 @@ public class ProjectGenerationStatPublisherTests extends AbstractInitializrStatT
|
||||
}
|
||||
|
||||
@Test
|
||||
public void publishDocument() {
|
||||
void publishDocument() {
|
||||
ProjectRequest request = createProjectRequest();
|
||||
request.setGroupId("com.example.foo");
|
||||
request.setArtifactId("my-project");
|
||||
@ -143,7 +143,7 @@ public class ProjectGenerationStatPublisherTests extends AbstractInitializrStatT
|
||||
}
|
||||
|
||||
@Test
|
||||
public void recoverFromError() {
|
||||
void recoverFromError() {
|
||||
ProjectRequest request = createProjectRequest();
|
||||
|
||||
this.mockServer.expect(requestTo("http://example.com/elastic/initializr/request"))
|
||||
@ -165,7 +165,7 @@ public class ProjectGenerationStatPublisherTests extends AbstractInitializrStatT
|
||||
}
|
||||
|
||||
@Test
|
||||
public void fatalErrorOnlyLogs() {
|
||||
void fatalErrorOnlyLogs() {
|
||||
ProjectRequest request = createProjectRequest();
|
||||
this.retryTemplate.setRetryPolicy(new SimpleRetryPolicy(2,
|
||||
Collections.singletonMap(Exception.class, true)));
|
||||
|
@ -28,13 +28,13 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
/**
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class ProjectRequestDocumentFactoryTests extends AbstractInitializrStatTests {
|
||||
class ProjectRequestDocumentFactoryTests extends AbstractInitializrStatTests {
|
||||
|
||||
private final ProjectRequestDocumentFactory factory = new ProjectRequestDocumentFactory(
|
||||
createProvider(getMetadata()));
|
||||
|
||||
@Test
|
||||
public void createDocumentForSimpleProject() {
|
||||
void createDocumentForSimpleProject() {
|
||||
ProjectRequest request = createProjectRequest();
|
||||
ProjectGeneratedEvent event = new ProjectGeneratedEvent(request);
|
||||
ProjectRequestDocument document = this.factory.createDocument(event);
|
||||
@ -53,7 +53,7 @@ public class ProjectRequestDocumentFactoryTests extends AbstractInitializrStatTe
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createDocumentWithRequestIp() {
|
||||
void createDocumentWithRequestIp() {
|
||||
ProjectRequest request = createProjectRequest();
|
||||
request.getParameters().put("x-forwarded-for", "10.0.0.123");
|
||||
ProjectGeneratedEvent event = new ProjectGeneratedEvent(request);
|
||||
@ -64,7 +64,7 @@ public class ProjectRequestDocumentFactoryTests extends AbstractInitializrStatTe
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createDocumentWithRequestIpv6() {
|
||||
void createDocumentWithRequestIpv6() {
|
||||
ProjectRequest request = createProjectRequest();
|
||||
request.getParameters().put("x-forwarded-for", "2001:db8:a0b:12f0::1");
|
||||
ProjectGeneratedEvent event = new ProjectGeneratedEvent(request);
|
||||
@ -75,7 +75,7 @@ public class ProjectRequestDocumentFactoryTests extends AbstractInitializrStatTe
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createDocumentWithCloudFlareHeaders() {
|
||||
void createDocumentWithCloudFlareHeaders() {
|
||||
ProjectRequest request = createProjectRequest();
|
||||
request.getParameters().put("cf-connecting-ip", "10.0.0.123");
|
||||
request.getParameters().put("cf-ipcountry", "BE");
|
||||
@ -87,7 +87,7 @@ public class ProjectRequestDocumentFactoryTests extends AbstractInitializrStatTe
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createDocumentWithCloudFlareIpv6() {
|
||||
void createDocumentWithCloudFlareIpv6() {
|
||||
ProjectRequest request = createProjectRequest();
|
||||
request.getParameters().put("cf-connecting-ip", "2001:db8:a0b:12f0::1");
|
||||
ProjectGeneratedEvent event = new ProjectGeneratedEvent(request);
|
||||
@ -98,7 +98,7 @@ public class ProjectRequestDocumentFactoryTests extends AbstractInitializrStatTe
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createDocumentWithCloudFlareHeadersAndOtherHeaders() {
|
||||
void createDocumentWithCloudFlareHeadersAndOtherHeaders() {
|
||||
ProjectRequest request = createProjectRequest();
|
||||
request.getParameters().put("cf-connecting-ip", "10.0.0.123");
|
||||
request.getParameters().put("x-forwarded-for", "192.168.1.101");
|
||||
@ -110,7 +110,7 @@ public class ProjectRequestDocumentFactoryTests extends AbstractInitializrStatTe
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createDocumentWithCloudFlareCountrySetToXX() {
|
||||
void createDocumentWithCloudFlareCountrySetToXX() {
|
||||
ProjectRequest request = createProjectRequest();
|
||||
request.getParameters().put("cf-connecting-ip", "Xx"); // case insensitive
|
||||
ProjectGeneratedEvent event = new ProjectGeneratedEvent(request);
|
||||
@ -119,7 +119,7 @@ public class ProjectRequestDocumentFactoryTests extends AbstractInitializrStatTe
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createDocumentWithUserAgent() {
|
||||
void createDocumentWithUserAgent() {
|
||||
ProjectRequest request = createProjectRequest();
|
||||
request.getParameters().put("user-agent", "HTTPie/0.8.0");
|
||||
ProjectGeneratedEvent event = new ProjectGeneratedEvent(request);
|
||||
@ -129,7 +129,7 @@ public class ProjectRequestDocumentFactoryTests extends AbstractInitializrStatTe
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createDocumentWithUserAgentNoVersion() {
|
||||
void createDocumentWithUserAgentNoVersion() {
|
||||
ProjectRequest request = createProjectRequest();
|
||||
request.getParameters().put("user-agent", "IntelliJ IDEA");
|
||||
ProjectGeneratedEvent event = new ProjectGeneratedEvent(request);
|
||||
@ -139,7 +139,7 @@ public class ProjectRequestDocumentFactoryTests extends AbstractInitializrStatTe
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createDocumentInvalidJavaVersion() {
|
||||
void createDocumentInvalidJavaVersion() {
|
||||
ProjectRequest request = createProjectRequest();
|
||||
request.setJavaVersion("1.2");
|
||||
ProjectGeneratedEvent event = new ProjectGeneratedEvent(request);
|
||||
@ -150,7 +150,7 @@ public class ProjectRequestDocumentFactoryTests extends AbstractInitializrStatTe
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createDocumentInvalidLanguage() {
|
||||
void createDocumentInvalidLanguage() {
|
||||
ProjectRequest request = createProjectRequest();
|
||||
request.setLanguage("c++");
|
||||
ProjectGeneratedEvent event = new ProjectGeneratedEvent(request);
|
||||
@ -161,7 +161,7 @@ public class ProjectRequestDocumentFactoryTests extends AbstractInitializrStatTe
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createDocumentInvalidPackaging() {
|
||||
void createDocumentInvalidPackaging() {
|
||||
ProjectRequest request = createProjectRequest();
|
||||
request.setPackaging("ear");
|
||||
ProjectGeneratedEvent event = new ProjectGeneratedEvent(request);
|
||||
@ -172,7 +172,7 @@ public class ProjectRequestDocumentFactoryTests extends AbstractInitializrStatTe
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createDocumentInvalidType() {
|
||||
void createDocumentInvalidType() {
|
||||
ProjectRequest request = createProjectRequest();
|
||||
request.setType("ant-project");
|
||||
ProjectGeneratedEvent event = new ProjectGeneratedEvent(request);
|
||||
@ -183,7 +183,7 @@ public class ProjectRequestDocumentFactoryTests extends AbstractInitializrStatTe
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createDocumentInvalidDependency() {
|
||||
void createDocumentInvalidDependency() {
|
||||
ProjectRequest request = createProjectRequest();
|
||||
request.setDependencies(Arrays.asList("web", "invalid", "data-jpa", "invalid-2"));
|
||||
ProjectGeneratedEvent event = new ProjectGeneratedEvent(request);
|
||||
@ -198,7 +198,7 @@ public class ProjectRequestDocumentFactoryTests extends AbstractInitializrStatTe
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createDocumentWithProjectFailedEvent() {
|
||||
void createDocumentWithProjectFailedEvent() {
|
||||
ProjectRequest request = createProjectRequest();
|
||||
ProjectFailedEvent event = new ProjectFailedEvent(request,
|
||||
new IllegalStateException("my test message"));
|
||||
|
@ -25,12 +25,12 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class StatsPropertiesTests {
|
||||
class StatsPropertiesTests {
|
||||
|
||||
private final StatsProperties properties = new StatsProperties();
|
||||
|
||||
@Test
|
||||
public void cleanTrailingSlash() {
|
||||
void cleanTrailingSlash() {
|
||||
this.properties.getElastic().setUri("http://example.com/");
|
||||
assertThat(this.properties.getElastic().getUri()).isEqualTo("http://example.com");
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
/**
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class CommandLineHelpGeneratorTests {
|
||||
class CommandLineHelpGeneratorTests {
|
||||
|
||||
private CommandLineHelpGenerator generator;
|
||||
|
||||
@ -41,7 +41,7 @@ public class CommandLineHelpGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generateGenericCapabilities() {
|
||||
void generateGenericCapabilities() {
|
||||
InitializrMetadata metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||
.addDependencyGroup("test", createDependency("id-b", "depB"),
|
||||
createDependency("id-a", "depA", "and some description"))
|
||||
@ -57,7 +57,7 @@ public class CommandLineHelpGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generateCapabilitiesWithTypeDescription() {
|
||||
void generateCapabilitiesWithTypeDescription() {
|
||||
Type type = new Type();
|
||||
type.setId("foo");
|
||||
type.setName("foo-name");
|
||||
@ -72,7 +72,7 @@ public class CommandLineHelpGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generateCapabilitiesWithAlias() {
|
||||
void generateCapabilitiesWithAlias() {
|
||||
Dependency dependency = createDependency("dep", "some description");
|
||||
dependency.setAliases(Arrays.asList("legacy", "another"));
|
||||
InitializrMetadata metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||
@ -85,7 +85,7 @@ public class CommandLineHelpGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generateCurlCapabilities() {
|
||||
void generateCurlCapabilities() {
|
||||
InitializrMetadata metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||
.addDependencyGroup("test", createDependency("id-b", "depB"),
|
||||
createDependency("id-a", "depA", "and some description"))
|
||||
@ -101,7 +101,7 @@ public class CommandLineHelpGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generateHttpCapabilities() {
|
||||
void generateHttpCapabilities() {
|
||||
InitializrMetadata metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||
.addDependencyGroup("test", createDependency("id-b", "depB"),
|
||||
createDependency("id-a", "depA", "and some description"))
|
||||
@ -118,7 +118,7 @@ public class CommandLineHelpGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generateSpringBootCliCapabilities() {
|
||||
void generateSpringBootCliCapabilities() {
|
||||
InitializrMetadata metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||
.addDependencyGroup("test", createDependency("id-b", "depB"),
|
||||
createDependency("id-a", "depA", "and some description"))
|
||||
@ -139,7 +139,7 @@ public class CommandLineHelpGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generateCapabilitiesWithVersionRange() {
|
||||
void generateCapabilitiesWithVersionRange() {
|
||||
Dependency first = Dependency.withId("first");
|
||||
first.setDescription("first desc");
|
||||
first.setVersionRange("1.2.0.RELEASE");
|
||||
|
@ -36,14 +36,14 @@ import static org.mockito.Mockito.times;
|
||||
* @author Torsten Walter
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class CustomProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
class CustomProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
|
||||
public CustomProjectGeneratorTests() {
|
||||
CustomProjectGeneratorTests() {
|
||||
super(new MyProjectGenerator());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generateCustomResource() {
|
||||
void generateCustomResource() {
|
||||
ProjectRequest request = createProjectRequest();
|
||||
request.setType("maven-project");
|
||||
request.setGroupId("com.example.custom");
|
||||
@ -53,7 +53,7 @@ public class CustomProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generateCustomResourceDisabled() {
|
||||
void generateCustomResourceDisabled() {
|
||||
ProjectRequest request = createProjectRequest();
|
||||
request.setType("gradle-build");
|
||||
request.setGroupId("com.example.custom");
|
||||
@ -62,7 +62,7 @@ public class CustomProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void projectGenerationEventFiredAfterCustomization() {
|
||||
void projectGenerationEventFiredAfterCustomization() {
|
||||
ProjectRequest request = createProjectRequest();
|
||||
request.setType("maven-project");
|
||||
request.setGroupId("com.example.custom");
|
||||
|
@ -35,7 +35,7 @@ import org.springframework.core.io.ClassPathResource;
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class ProjectGeneratorBuildTests extends AbstractProjectGeneratorTests {
|
||||
class ProjectGeneratorBuildTests extends AbstractProjectGeneratorTests {
|
||||
|
||||
public static Stream<Arguments> parameters() {
|
||||
return Stream.of(Arguments.arguments("maven", "pom.xml"),
|
||||
|
@ -30,7 +30,7 @@ import org.springframework.core.io.ClassPathResource;
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class ProjectGeneratorLanguageTests extends AbstractProjectGeneratorTests {
|
||||
class ProjectGeneratorLanguageTests extends AbstractProjectGeneratorTests {
|
||||
|
||||
public static Stream<Arguments> parameters() {
|
||||
return Stream.of(Arguments.arguments("java", "java"),
|
||||
|
@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.fail;
|
||||
* @author Stephane Nicoll
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
|
||||
@Override
|
||||
protected InitializrMetadataTestBuilder initializeTestMetadataBuilder() {
|
||||
@ -47,21 +47,21 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void defaultMavenPom() {
|
||||
void defaultMavenPom() {
|
||||
ProjectRequest request = createProjectRequest("web");
|
||||
generateMavenPom(request).hasNoRepository().hasSpringBootStarterDependency("web");
|
||||
verifyProjectSuccessfulEventFor(request);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void defaultGradleBuild() {
|
||||
void defaultGradleBuild() {
|
||||
ProjectRequest request = createProjectRequest("web");
|
||||
generateGradleBuild(request).doesNotContain("import");
|
||||
verifyProjectSuccessfulEventFor(request);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void defaultProject() {
|
||||
void defaultProject() {
|
||||
ProjectRequest request = createProjectRequest("web");
|
||||
generateProject(request).isJavaProject().isMavenProject().pomAssert()
|
||||
.hasNoRepository().hasSpringBootStarterDependency("web");
|
||||
@ -69,7 +69,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void defaultProjectWithGradle() {
|
||||
void defaultProjectWithGradle() {
|
||||
ProjectRequest request = createProjectRequest("web");
|
||||
request.setType("gradle-build");
|
||||
ProjectAssert gradleProject = generateProject(request).isGradleProject();
|
||||
@ -82,14 +82,14 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void noDependencyAddsRootStarter() {
|
||||
void noDependencyAddsRootStarter() {
|
||||
ProjectRequest request = createProjectRequest();
|
||||
generateProject(request).isJavaProject().isMavenProject().pomAssert()
|
||||
.hasSpringBootStarterRootDependency();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mavenPomWithBootSnapshot() {
|
||||
void mavenPomWithBootSnapshot() {
|
||||
ProjectRequest request = createProjectRequest("web");
|
||||
request.setBootVersion("2.1.1.BUILD-SNAPSHOT");
|
||||
generateMavenPom(request).hasSnapshotRepository()
|
||||
@ -98,7 +98,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mavenPomWithTarDependency() {
|
||||
void mavenPomWithTarDependency() {
|
||||
Dependency dependency = Dependency.withId("custom-artifact", "org.foo",
|
||||
"custom-artifact");
|
||||
dependency.setType("tar.gz");
|
||||
@ -111,7 +111,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void gradleBuildWithTarDependency() {
|
||||
void gradleBuildWithTarDependency() {
|
||||
Dependency dependency = Dependency.withId("custom-artifact", "org.foo",
|
||||
"custom-artifact");
|
||||
dependency.setType("tar.gz");
|
||||
@ -125,7 +125,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mavenPomWithWebFacet() {
|
||||
void mavenPomWithWebFacet() {
|
||||
Dependency dependency = Dependency.withId("thymeleaf", "org.foo", "thymeleaf");
|
||||
dependency.getFacets().add("web");
|
||||
InitializrMetadata metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||
@ -139,7 +139,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mavenWarWithWebFacet() {
|
||||
void mavenWarWithWebFacet() {
|
||||
Dependency dependency = Dependency.withId("thymeleaf", "org.foo", "thymeleaf");
|
||||
dependency.getFacets().add("web");
|
||||
InitializrMetadata metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||
@ -157,7 +157,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mavenWarPomWithoutWebFacet() {
|
||||
void mavenWarPomWithoutWebFacet() {
|
||||
ProjectRequest request = createProjectRequest("data-jpa");
|
||||
request.setPackaging("war");
|
||||
generateMavenPom(request).hasSpringBootStarterTomcat()
|
||||
@ -167,7 +167,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mavenWarPomWithoutWebFacetAndWithoutWebDependency() {
|
||||
void mavenWarPomWithoutWebFacetAndWithoutWebDependency() {
|
||||
InitializrMetadata metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||
.addDependencyGroup("core", "security", "data-jpa").build();
|
||||
applyMetadata(metadata);
|
||||
@ -181,7 +181,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mavenWarPomWithoutWebFacetAndWithCustomWebDependency() {
|
||||
void mavenWarPomWithoutWebFacetAndWithCustomWebDependency() {
|
||||
Dependency customWebStarter = Dependency.withId("web", "org.acme", "web-starter");
|
||||
InitializrMetadata metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||
.addDependencyGroup("core", "security", "data-jpa")
|
||||
@ -196,7 +196,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void gradleWarWithWebFacet() {
|
||||
void gradleWarWithWebFacet() {
|
||||
Dependency dependency = Dependency.withId("thymeleaf", "org.foo", "thymeleaf");
|
||||
dependency.getFacets().add("web");
|
||||
InitializrMetadata metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||
@ -221,7 +221,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void gradleWarPomWithoutWebFacet() {
|
||||
void gradleWarPomWithoutWebFacet() {
|
||||
ProjectRequest request = createProjectRequest("data-jpa");
|
||||
request.setPackaging("war");
|
||||
generateGradleBuild(request).contains(
|
||||
@ -237,7 +237,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void groupIdAndArtifactIdInferPackageName() {
|
||||
void groupIdAndArtifactIdInferPackageName() {
|
||||
ProjectRequest request = createProjectRequest("web");
|
||||
request.setGroupId("org.acme");
|
||||
request.setArtifactId("42foo");
|
||||
@ -245,7 +245,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void cleanPackageNameWithGroupIdAndArtifactIdWithVersion() {
|
||||
void cleanPackageNameWithGroupIdAndArtifactIdWithVersion() {
|
||||
ProjectRequest request = createProjectRequest("web");
|
||||
request.setGroupId("org.acme");
|
||||
request.setArtifactId("foo-1.4.5");
|
||||
@ -253,7 +253,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void cleanPackageNameWithInvalidPackageName() {
|
||||
void cleanPackageNameWithInvalidPackageName() {
|
||||
ProjectRequest request = createProjectRequest("web");
|
||||
request.setGroupId("org.acme");
|
||||
request.setArtifactId("foo");
|
||||
@ -268,7 +268,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void gradleProjectWithCustomArtifactId() {
|
||||
void gradleProjectWithCustomArtifactId() {
|
||||
ProjectRequest request = createProjectRequest();
|
||||
request.setType("gradle-build");
|
||||
request.setArtifactId("my-application");
|
||||
@ -278,7 +278,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void springBootUseSpringBootApplicationJava() {
|
||||
void springBootUseSpringBootApplicationJava() {
|
||||
ProjectRequest request = createProjectRequest("web");
|
||||
request.setName("MyDemo");
|
||||
request.setPackageName("foo");
|
||||
@ -289,7 +289,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void springBootUseSpringBootApplicationGroovy() {
|
||||
void springBootUseSpringBootApplicationGroovy() {
|
||||
ProjectRequest request = createProjectRequest("web");
|
||||
request.setLanguage("groovy");
|
||||
request.setName("MyDemo");
|
||||
@ -301,7 +301,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void springBootUseSpringBootApplicationKotlin() {
|
||||
void springBootUseSpringBootApplicationKotlin() {
|
||||
ProjectRequest request = createProjectRequest("web");
|
||||
request.setLanguage("kotlin");
|
||||
request.setName("MyDemo");
|
||||
@ -316,7 +316,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void springBoot15UseGradle3() {
|
||||
void springBoot15UseGradle3() {
|
||||
ProjectRequest request = createProjectRequest("web");
|
||||
request.setType("gradle-project");
|
||||
request.setBootVersion("1.5.0.RELEASE");
|
||||
@ -324,7 +324,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void springBoot20UsesGradle4() {
|
||||
void springBoot20UsesGradle4() {
|
||||
ProjectRequest request = createProjectRequest("web");
|
||||
request.setType("gradle-project");
|
||||
request.setBootVersion("2.0.0.RELEASE");
|
||||
@ -332,7 +332,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void customBaseDirectory() {
|
||||
void customBaseDirectory() {
|
||||
ProjectRequest request = createProjectRequest();
|
||||
request.setBaseDir("my-project");
|
||||
generateProject(request).hasBaseDir("my-project").isJavaProject()
|
||||
@ -340,7 +340,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void customBaseDirectoryNested() {
|
||||
void customBaseDirectoryNested() {
|
||||
ProjectRequest request = createProjectRequest();
|
||||
request.setBaseDir("foo-bar/my-project");
|
||||
generateProject(request).hasBaseDir("foo-bar/my-project").isJavaProject()
|
||||
@ -348,7 +348,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void groovyWithMavenUsesGroovyDir() {
|
||||
void groovyWithMavenUsesGroovyDir() {
|
||||
ProjectRequest request = createProjectRequest("web");
|
||||
request.setType("maven-project");
|
||||
request.setLanguage("groovy");
|
||||
@ -356,7 +356,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void groovyWithGradleUsesGroovyDir() {
|
||||
void groovyWithGradleUsesGroovyDir() {
|
||||
ProjectRequest request = createProjectRequest("web");
|
||||
request.setType("gradle-project");
|
||||
request.setLanguage("groovy");
|
||||
@ -364,7 +364,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mavenPomWithCustomVersion() {
|
||||
void mavenPomWithCustomVersion() {
|
||||
Dependency whatever = Dependency.withId("whatever", "org.acme", "whatever",
|
||||
"1.2.3");
|
||||
InitializrMetadata metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||
@ -378,7 +378,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void defaultMavenPomHasSpringBootParent() {
|
||||
void defaultMavenPomHasSpringBootParent() {
|
||||
ProjectRequest request = createProjectRequest("web");
|
||||
generateMavenPom(request).hasSpringBootParent(request.getBootVersion())
|
||||
.hasNoProperty("project.build.sourceEncoding")
|
||||
@ -386,7 +386,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mavenPomWithCustomParentPom() {
|
||||
void mavenPomWithCustomParentPom() {
|
||||
InitializrMetadata metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||
.addDependencyGroup("core", "web", "security", "data-jpa")
|
||||
.setMavenParent("com.foo", "foo-parent", "1.0.0-SNAPSHOT", false).build();
|
||||
@ -398,7 +398,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mavenPomWithCustomParentPomAndSpringBootBom() {
|
||||
void mavenPomWithCustomParentPomAndSpringBootBom() {
|
||||
InitializrMetadata metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||
.addDependencyGroup("core", "web", "security", "data-jpa")
|
||||
.setMavenParent("com.foo", "foo-parent", "1.0.0-SNAPSHOT", true).build();
|
||||
@ -414,7 +414,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void gradleBuildWithCustomParentPomAndSpringBootBom() {
|
||||
void gradleBuildWithCustomParentPomAndSpringBootBom() {
|
||||
InitializrMetadata metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||
.addDependencyGroup("core", "web", "security", "data-jpa")
|
||||
.setMavenParent("com.foo", "foo-parent", "1.0.0-SNAPSHOT", true).build();
|
||||
@ -428,14 +428,14 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void gradleBuildWithBootSnapshot() {
|
||||
void gradleBuildWithBootSnapshot() {
|
||||
ProjectRequest request = createProjectRequest("web");
|
||||
request.setBootVersion("2.1.1.BUILD-SNAPSHOT");
|
||||
generateGradleBuild(request).hasSnapshotRepository();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void gradleBuildWithCustomVersion() {
|
||||
void gradleBuildWithCustomVersion() {
|
||||
Dependency whatever = Dependency.withId("whatever", "org.acme", "whatever",
|
||||
"1.2.3");
|
||||
InitializrMetadata metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||
@ -451,7 +451,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mavenPomWithCustomScope() {
|
||||
void mavenPomWithCustomScope() {
|
||||
Dependency h2 = Dependency.withId("h2", "org.h2", "h2");
|
||||
h2.setScope("runtime");
|
||||
Dependency hamcrest = Dependency.withId("hamcrest", "org.hamcrest", "hamcrest");
|
||||
@ -473,7 +473,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void gradleBuildWithCustomScope() {
|
||||
void gradleBuildWithCustomScope() {
|
||||
Dependency h2 = Dependency.withId("h2", "org.h2", "h2");
|
||||
h2.setScope("runtime");
|
||||
Dependency hamcrest = Dependency.withId("hamcrest", "org.hamcrest", "hamcrest");
|
||||
@ -501,7 +501,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void gradleBuildWithSpringBoot15() {
|
||||
void gradleBuildWithSpringBoot15() {
|
||||
ProjectRequest request = createProjectRequest("web");
|
||||
request.setBootVersion("1.5.20.BUILD-SNAPSHOT");
|
||||
generateGradleBuild(request).contains("apply plugin: 'org.springframework.boot'")
|
||||
@ -513,7 +513,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void gradleBuildWithSpringBoot20() {
|
||||
void gradleBuildWithSpringBoot20() {
|
||||
ProjectRequest request = createProjectRequest("web");
|
||||
request.setBootVersion("2.0.0.RELEASE");
|
||||
generateGradleBuild(request).contains("apply plugin: 'org.springframework.boot'")
|
||||
@ -526,7 +526,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mavenBom() {
|
||||
void mavenBom() {
|
||||
Dependency foo = Dependency.withId("foo", "org.acme", "foo");
|
||||
foo.setBom("foo-bom");
|
||||
InitializrMetadata metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||
@ -539,7 +539,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mavenBomWithSeveralDependenciesOnSameBom() {
|
||||
void mavenBomWithSeveralDependenciesOnSameBom() {
|
||||
Dependency foo = Dependency.withId("foo", "org.acme", "foo");
|
||||
foo.setBom("the-bom");
|
||||
Dependency bar = Dependency.withId("bar", "org.acme", "bar");
|
||||
@ -554,7 +554,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mavenBomWithVersionMapping() {
|
||||
void mavenBomWithVersionMapping() {
|
||||
Dependency foo = Dependency.withId("foo", "org.acme", "foo");
|
||||
foo.setBom("the-bom");
|
||||
BillOfMaterials bom = BillOfMaterials.create("org.acme", "foo-bom");
|
||||
@ -579,7 +579,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mavenBomWithVersionMappingAndExtraRepositories() {
|
||||
void mavenBomWithVersionMappingAndExtraRepositories() {
|
||||
Dependency foo = Dependency.withId("foo", "org.acme", "foo");
|
||||
foo.setBom("the-bom");
|
||||
BillOfMaterials bom = BillOfMaterials.create("org.acme", "foo-bom");
|
||||
@ -606,7 +606,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void gradleBom() {
|
||||
void gradleBom() {
|
||||
Dependency foo = Dependency.withId("foo", "org.acme", "foo");
|
||||
foo.setBom("foo-bom");
|
||||
InitializrMetadata metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||
@ -619,7 +619,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mavenRepository() {
|
||||
void mavenRepository() {
|
||||
Dependency foo = Dependency.withId("foo", "org.acme", "foo");
|
||||
foo.setRepository("foo-repo");
|
||||
InitializrMetadata metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||
@ -633,7 +633,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mavenRepositoryWithSeveralDependenciesOnSameRepository() {
|
||||
void mavenRepositoryWithSeveralDependenciesOnSameRepository() {
|
||||
Dependency foo = Dependency.withId("foo", "org.acme", "foo");
|
||||
foo.setRepository("the-repo");
|
||||
Dependency bar = Dependency.withId("bar", "org.acme", "bar");
|
||||
@ -650,7 +650,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void gradleRepository() {
|
||||
void gradleRepository() {
|
||||
Dependency foo = Dependency.withId("foo", "org.acme", "foo");
|
||||
foo.setRepository("foo-repo");
|
||||
InitializrMetadata metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||
@ -663,7 +663,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void projectWithOnlyStarterDependency() {
|
||||
void projectWithOnlyStarterDependency() {
|
||||
Dependency foo = Dependency.withId("foo", "org.foo", "custom-my-starter");
|
||||
InitializrMetadata metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||
.addDependencyGroup("foo", foo).build();
|
||||
@ -675,7 +675,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void projectWithOnlyNonStarterDependency() {
|
||||
void projectWithOnlyNonStarterDependency() {
|
||||
Dependency foo = Dependency.withId("foo", "org.foo", "foo");
|
||||
foo.setStarter(false);
|
||||
InitializrMetadata metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||
@ -689,7 +689,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void buildPropertiesMaven() {
|
||||
void buildPropertiesMaven() {
|
||||
ProjectRequest request = createProjectRequest("web");
|
||||
request.getBuildProperties().getMaven().put("name", () -> "test");
|
||||
request.getBuildProperties().getVersions().put(VersionProperty.of("foo.version"),
|
||||
@ -701,7 +701,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void buildPropertiesGradle() {
|
||||
void buildPropertiesGradle() {
|
||||
ProjectRequest request = createProjectRequest("web");
|
||||
request.getBuildProperties().getGradle().put("name", () -> "test");
|
||||
request.getBuildProperties().getVersions()
|
||||
@ -716,7 +716,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void versionRangeWithPostProcessor() {
|
||||
void versionRangeWithPostProcessor() {
|
||||
Dependency foo = Dependency.withId("foo", "org.acme", "foo");
|
||||
foo.getMappings().add(Dependency.Mapping.create("[2.2.0.RELEASE,2.3.0.M1)", null,
|
||||
null, "1.0.0"));
|
||||
@ -745,7 +745,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void gitIgnoreMaven() {
|
||||
void gitIgnoreMaven() {
|
||||
ProjectRequest request = createProjectRequest();
|
||||
request.setType("maven-project");
|
||||
ProjectAssert project = generateProject(request);
|
||||
@ -754,7 +754,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void gitIgnoreGradle() {
|
||||
void gitIgnoreGradle() {
|
||||
ProjectRequest request = createProjectRequest();
|
||||
request.setType("gradle-project");
|
||||
ProjectAssert project = generateProject(request);
|
||||
@ -763,7 +763,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void dependencyOrderSpringBootTakesPrecedence() {
|
||||
void dependencyOrderSpringBootTakesPrecedence() {
|
||||
Dependency depOne = Dependency.withId("one", "org.acme", "first", "1.2.3");
|
||||
Dependency depTwo = Dependency.withId("two", "com.example", "second", "1.2.3");
|
||||
InitializrMetadata metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||
@ -779,7 +779,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void invalidProjectTypeMavenPom() {
|
||||
void invalidProjectTypeMavenPom() {
|
||||
ProjectRequest request = createProjectRequest("web");
|
||||
request.setType("gradle-build");
|
||||
assertThatExceptionOfType(InvalidProjectRequestException.class)
|
||||
@ -788,7 +788,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void invalidProjectTypeGradleBuild() {
|
||||
void invalidProjectTypeGradleBuild() {
|
||||
ProjectRequest request = createProjectRequest("web");
|
||||
request.setType("maven-build");
|
||||
assertThatExceptionOfType(InvalidProjectRequestException.class)
|
||||
@ -797,7 +797,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void invalidDependency() {
|
||||
void invalidDependency() {
|
||||
ProjectRequest request = createProjectRequest("foo-bar");
|
||||
try {
|
||||
generateMavenPom(request);
|
||||
@ -810,7 +810,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void invalidType() {
|
||||
void invalidType() {
|
||||
ProjectRequest request = createProjectRequest("web");
|
||||
request.setType("foo-bar");
|
||||
try {
|
||||
@ -824,7 +824,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void invalidPackaging() {
|
||||
void invalidPackaging() {
|
||||
ProjectRequest request = createProjectRequest("web");
|
||||
request.setPackaging("foo-bar");
|
||||
try {
|
||||
@ -838,7 +838,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void invalidLanguage() {
|
||||
void invalidLanguage() {
|
||||
ProjectRequest request = createProjectRequest("web");
|
||||
request.setLanguage("foo-bar");
|
||||
try {
|
||||
@ -852,7 +852,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void invalidSpringBootVersion() {
|
||||
void invalidSpringBootVersion() {
|
||||
ProjectRequest request = createProjectRequest("web");
|
||||
request.setType("maven-project");
|
||||
request.setBootVersion("1.2.3.M4");
|
||||
@ -862,7 +862,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void kotlinWithMavenUseJpaFacetHasJpaKotlinPlugin() {
|
||||
void kotlinWithMavenUseJpaFacetHasJpaKotlinPlugin() {
|
||||
applyJpaMetadata(true);
|
||||
ProjectRequest request = createProjectRequest("data-jpa");
|
||||
request.setType("maven-project");
|
||||
@ -872,7 +872,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void kotlinWithMavenWithoutJpaFacetDoesNotHaveJpaKotlinPlugin() {
|
||||
void kotlinWithMavenWithoutJpaFacetDoesNotHaveJpaKotlinPlugin() {
|
||||
applyJpaMetadata(false);
|
||||
ProjectRequest request = createProjectRequest("data-jpa");
|
||||
request.setType("maven-project");
|
||||
@ -882,7 +882,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void javaWithMavenUseJpaFacetDoesNotHaveJpaKotlinPlugin() {
|
||||
void javaWithMavenUseJpaFacetDoesNotHaveJpaKotlinPlugin() {
|
||||
applyJpaMetadata(true);
|
||||
ProjectRequest request = createProjectRequest("data-jpa");
|
||||
request.setType("maven-project");
|
||||
@ -892,7 +892,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void kotlinWithGradleUseJpaFacetHasJpaKotlinPlugin() {
|
||||
void kotlinWithGradleUseJpaFacetHasJpaKotlinPlugin() {
|
||||
applyJpaMetadata(true);
|
||||
ProjectRequest request = createProjectRequest("data-jpa");
|
||||
request.setType("gradle-project");
|
||||
@ -901,7 +901,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void kotlinWithGradleWithoutJpaFacetDoesNotHaveJpaKotlinPlugin() {
|
||||
void kotlinWithGradleWithoutJpaFacetDoesNotHaveJpaKotlinPlugin() {
|
||||
applyJpaMetadata(false);
|
||||
ProjectRequest request = createProjectRequest("data-jpa");
|
||||
request.setType("gradle-project");
|
||||
@ -910,7 +910,7 @@ public class ProjectGeneratorTests extends AbstractProjectGeneratorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void javaWithGradleUseJpaFacetDoesNotHaveJpaKotlinPlugin() {
|
||||
void javaWithGradleUseJpaFacetDoesNotHaveJpaKotlinPlugin() {
|
||||
applyJpaMetadata(true);
|
||||
ProjectRequest request = createProjectRequest("data-jpa");
|
||||
request.setType("gradle-project");
|
||||
|
@ -36,7 +36,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class ProjectRequestResolverTests {
|
||||
class ProjectRequestResolverTests {
|
||||
|
||||
private InitializrMetadata metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||
.addDependencyGroup("test", "web", "security", "data-jpa").build();
|
||||
@ -51,7 +51,7 @@ public class ProjectRequestResolverTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void beforeResolution() {
|
||||
void beforeResolution() {
|
||||
this.processor.before.put("javaVersion", "1.2");
|
||||
ProjectRequest request = resolve(createMavenProjectRequest(),
|
||||
this.postProcessors);
|
||||
@ -61,7 +61,7 @@ public class ProjectRequestResolverTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void afterResolution() {
|
||||
void afterResolution() {
|
||||
this.postProcessors.add(new ProjectRequestPostProcessor() {
|
||||
@Override
|
||||
public void postProcessAfterResolution(ProjectRequest request,
|
||||
|
@ -32,13 +32,13 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
/**
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class ProjectRequestTests {
|
||||
class ProjectRequestTests {
|
||||
|
||||
private InitializrMetadata metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||
.build();
|
||||
|
||||
@Test
|
||||
public void initializeGroupIdAndArtifactId() {
|
||||
void initializeGroupIdAndArtifactId() {
|
||||
this.metadata = InitializrMetadataBuilder.create().build();
|
||||
this.metadata.getGroupId().setContent("org.acme");
|
||||
this.metadata.getArtifactId().setContent("my-project");
|
||||
@ -48,7 +48,7 @@ public class ProjectRequestTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void initializeSetsMetadataDefaults() {
|
||||
void initializeSetsMetadataDefaults() {
|
||||
ProjectRequest request = initProjectRequest();
|
||||
assertThat(request.getName()).isEqualTo(this.metadata.getName().getContent());
|
||||
assertThat(request.getType())
|
||||
@ -68,7 +68,7 @@ public class ProjectRequestTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolve() {
|
||||
void resolve() {
|
||||
this.metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||
.addDependencyGroup("code", "web", "security", "spring-data").build();
|
||||
ProjectRequest request = initProjectRequest();
|
||||
@ -81,7 +81,7 @@ public class ProjectRequestTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveWithDependencies() {
|
||||
void resolveWithDependencies() {
|
||||
this.metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||
.addDependencyGroup("code", "web", "security", "spring-data").build();
|
||||
ProjectRequest request = initProjectRequest();
|
||||
@ -94,7 +94,7 @@ public class ProjectRequestTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveFullMetadata() {
|
||||
void resolveFullMetadata() {
|
||||
this.metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||
.addDependencyGroup("code", createDependency("org.foo", "acme", "1.2.0"))
|
||||
.build();
|
||||
@ -106,7 +106,7 @@ public class ProjectRequestTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveUnknownSimpleId() {
|
||||
void resolveUnknownSimpleId() {
|
||||
this.metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||
.addDependencyGroup("code", "org.foo:bar").build();
|
||||
ProjectRequest request = initProjectRequest();
|
||||
@ -117,7 +117,7 @@ public class ProjectRequestTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveUnknownDependency() {
|
||||
void resolveUnknownDependency() {
|
||||
this.metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||
.addDependencyGroup("code", "org.foo:bar").build();
|
||||
ProjectRequest request = initProjectRequest();
|
||||
@ -128,7 +128,7 @@ public class ProjectRequestTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveDependencyInRange() {
|
||||
void resolveDependencyInRange() {
|
||||
Dependency dependency = createDependency("org.foo", "bar", "1.2.0.RELEASE");
|
||||
dependency.setVersionRange("[1.0.1.RELEASE, 1.2.0.RELEASE)");
|
||||
InitializrMetadata metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||
@ -140,7 +140,7 @@ public class ProjectRequestTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveDependencyNotInRange() {
|
||||
void resolveDependencyNotInRange() {
|
||||
Dependency dependency = createDependency("org.foo", "bar", "1.2.0.RELEASE");
|
||||
dependency.setVersionRange("[1.0.1.RELEASE, 1.2.0.RELEASE)");
|
||||
InitializrMetadata metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||
@ -155,7 +155,7 @@ public class ProjectRequestTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveDependencyVersion() {
|
||||
void resolveDependencyVersion() {
|
||||
Dependency dependency = createDependency("org.foo", "bar", "1.2.0.RELEASE");
|
||||
dependency.getMappings().add(Mapping.create("[1.0.0.RELEASE, 1.1.0.RELEASE)",
|
||||
null, null, "0.1.0.RELEASE"));
|
||||
@ -180,7 +180,7 @@ public class ProjectRequestTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveBuild() {
|
||||
void resolveBuild() {
|
||||
ProjectRequest request = initProjectRequest();
|
||||
request.setType("gradle-project");
|
||||
request.resolve(this.metadata);
|
||||
@ -188,7 +188,7 @@ public class ProjectRequestTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveBuildNoTag() {
|
||||
void resolveBuildNoTag() {
|
||||
this.metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||
.addType("foo", false, "/foo.zip", null, null).build();
|
||||
ProjectRequest request = initProjectRequest();
|
||||
@ -198,7 +198,7 @@ public class ProjectRequestTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveUnknownType() {
|
||||
void resolveUnknownType() {
|
||||
ProjectRequest request = initProjectRequest();
|
||||
request.setType("foo-project");
|
||||
assertThatExceptionOfType(InvalidProjectRequestException.class)
|
||||
@ -207,7 +207,7 @@ public class ProjectRequestTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveApplicationNameWithNoName() {
|
||||
void resolveApplicationNameWithNoName() {
|
||||
ProjectRequest request = initProjectRequest();
|
||||
request.setName(null);
|
||||
request.resolve(this.metadata);
|
||||
@ -216,7 +216,7 @@ public class ProjectRequestTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveApplicationName() {
|
||||
void resolveApplicationName() {
|
||||
ProjectRequest request = initProjectRequest();
|
||||
request.setName("Foo2");
|
||||
request.resolve(this.metadata);
|
||||
@ -224,7 +224,7 @@ public class ProjectRequestTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveApplicationNameWithApplicationNameSet() {
|
||||
void resolveApplicationNameWithApplicationNameSet() {
|
||||
ProjectRequest request = initProjectRequest();
|
||||
request.setName("Foo2");
|
||||
request.setApplicationName("MyApplicationName");
|
||||
@ -234,7 +234,7 @@ public class ProjectRequestTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void packageNameInferredByGroupIdAndArtifactId() {
|
||||
void packageNameInferredByGroupIdAndArtifactId() {
|
||||
ProjectRequest request = initProjectRequest();
|
||||
request.setGroupId("org.acme");
|
||||
request.setArtifactId("foo");
|
||||
@ -243,7 +243,7 @@ public class ProjectRequestTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void packageNameInferredByGroupIdAndCompositeArtifactId() {
|
||||
void packageNameInferredByGroupIdAndCompositeArtifactId() {
|
||||
ProjectRequest request = initProjectRequest();
|
||||
request.setGroupId("org.acme");
|
||||
request.setArtifactId("foo-bar");
|
||||
@ -252,7 +252,7 @@ public class ProjectRequestTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void packageNameUseFallbackIfGroupIdNotSet() {
|
||||
void packageNameUseFallbackIfGroupIdNotSet() {
|
||||
ProjectRequest request = initProjectRequest();
|
||||
request.setGroupId(null);
|
||||
request.setArtifactId("foo");
|
||||
@ -261,7 +261,7 @@ public class ProjectRequestTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void packageNameUseFallbackIfArtifactIdNotSet() {
|
||||
void packageNameUseFallbackIfArtifactIdNotSet() {
|
||||
ProjectRequest request = initProjectRequest();
|
||||
request.setGroupId("org.acme");
|
||||
request.setArtifactId(null);
|
||||
@ -270,7 +270,7 @@ public class ProjectRequestTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void cleanPackageNameLeadingNumbers() {
|
||||
void cleanPackageNameLeadingNumbers() {
|
||||
ProjectRequest request = new ProjectRequest();
|
||||
request.setPackageName("org.foo.42bar");
|
||||
InitializrMetadata metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||
@ -281,7 +281,7 @@ public class ProjectRequestTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void cleanPackageNameWithNoName() {
|
||||
void cleanPackageNameWithNoName() {
|
||||
ProjectRequest request = initProjectRequest();
|
||||
request.resolve(this.metadata);
|
||||
assertThat(request.getPackageName())
|
||||
@ -289,7 +289,7 @@ public class ProjectRequestTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void cleanPackageName() {
|
||||
void cleanPackageName() {
|
||||
ProjectRequest request = initProjectRequest();
|
||||
request.setPackageName("com:foo bar");
|
||||
request.resolve(this.metadata);
|
||||
@ -297,7 +297,7 @@ public class ProjectRequestTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveAdditionalBoms() {
|
||||
void resolveAdditionalBoms() {
|
||||
Dependency dependency = Dependency.withId("foo");
|
||||
dependency.setBom("foo-bom");
|
||||
BillOfMaterials bom = BillOfMaterials.create("com.example", "foo-bom", "1.0.0");
|
||||
@ -317,7 +317,7 @@ public class ProjectRequestTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveAdditionalBomsDuplicates() {
|
||||
void resolveAdditionalBomsDuplicates() {
|
||||
Dependency dependency = Dependency.withId("foo");
|
||||
dependency.setBom("foo-bom");
|
||||
Dependency anotherDependency = Dependency.withId("bar");
|
||||
@ -339,7 +339,7 @@ public class ProjectRequestTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveAdditionalRepositories() {
|
||||
void resolveAdditionalRepositories() {
|
||||
Dependency dependency = Dependency.withId("foo");
|
||||
dependency.setBom("foo-bom");
|
||||
dependency.setRepository("foo-repo");
|
||||
@ -363,7 +363,7 @@ public class ProjectRequestTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveAdditionalRepositoriesDuplicates() {
|
||||
void resolveAdditionalRepositoriesDuplicates() {
|
||||
Dependency dependency = Dependency.withId("foo");
|
||||
dependency.setBom("foo-bom");
|
||||
dependency.setRepository("foo-repo");
|
||||
|
@ -29,10 +29,10 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
|
||||
/**
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class BillOfMaterialsTests {
|
||||
class BillOfMaterialsTests {
|
||||
|
||||
@Test
|
||||
public void resolveSimpleBom() {
|
||||
void resolveSimpleBom() {
|
||||
BillOfMaterials bom = BillOfMaterials.create("com.example", "bom", "1.0.0");
|
||||
bom.validate();
|
||||
BillOfMaterials resolved = bom.resolve(Version.parse("1.2.3.RELEASE"));
|
||||
@ -40,7 +40,7 @@ public class BillOfMaterialsTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveSimpleRange() {
|
||||
void resolveSimpleRange() {
|
||||
BillOfMaterials bom = BillOfMaterials.create("com.example", "bom", "1.0.0");
|
||||
bom.setVersionProperty("bom.version");
|
||||
bom.getRepositories().add("repo-main");
|
||||
@ -60,7 +60,7 @@ public class BillOfMaterialsTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveSimpleRangeWithGroupIdArtifactId() {
|
||||
void resolveSimpleRangeWithGroupIdArtifactId() {
|
||||
BillOfMaterials bom = BillOfMaterials.create("com.example", "bom", "1.0.0");
|
||||
bom.setVersionProperty("bom.version");
|
||||
bom.getRepositories().add("repo-main");
|
||||
@ -83,7 +83,7 @@ public class BillOfMaterialsTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveRangeOverride() {
|
||||
void resolveRangeOverride() {
|
||||
BillOfMaterials bom = BillOfMaterials.create("com.example", "bom", "1.0.0");
|
||||
bom.getRepositories().add("repo-main");
|
||||
bom.getAdditionalBoms().add("bom-main");
|
||||
@ -103,7 +103,7 @@ public class BillOfMaterialsTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveRangeOverrideAndMapping() {
|
||||
void resolveRangeOverrideAndMapping() {
|
||||
BillOfMaterials bom = BillOfMaterials.create("com.example", "bom", "1.0.0");
|
||||
bom.setVersionProperty("example.version");
|
||||
bom.getMappings().add(Mapping.create("[1.2.0.RELEASE,1.3.0.M1)", "1.1.0"));
|
||||
@ -117,7 +117,7 @@ public class BillOfMaterialsTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void noRangeAvailable() {
|
||||
void noRangeAvailable() {
|
||||
BillOfMaterials bom = BillOfMaterials.create("com.example", "bom");
|
||||
bom.getMappings().add(Mapping.create("[1.2.0.RELEASE,1.3.0.M1)", "1.1.0"));
|
||||
bom.getMappings().add(Mapping.create("[1.3.0.M1, 1.4.0.M1)", "1.2.0"));
|
||||
@ -128,7 +128,7 @@ public class BillOfMaterialsTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveRangeWithVariablePatch() {
|
||||
void resolveRangeWithVariablePatch() {
|
||||
BillOfMaterials bom = BillOfMaterials.create("com.example", "bom", "1.0.0");
|
||||
bom.getMappings().add(Mapping.create("[1.3.0.RELEASE,1.3.x.RELEASE]", "1.1.0"));
|
||||
bom.getMappings().add(BillOfMaterials.Mapping
|
||||
|
@ -26,10 +26,10 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class DependenciesCapabilityTests {
|
||||
class DependenciesCapabilityTests {
|
||||
|
||||
@Test
|
||||
public void indexedDependencies() {
|
||||
void indexedDependencies() {
|
||||
Dependency dependency = Dependency.withId("first");
|
||||
Dependency dependency2 = Dependency.withId("second");
|
||||
DependenciesCapability capability = createDependenciesCapability("foo",
|
||||
@ -42,7 +42,7 @@ public class DependenciesCapabilityTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addTwoDependenciesWithSameId() {
|
||||
void addTwoDependenciesWithSameId() {
|
||||
Dependency dependency = Dependency.withId("conflict");
|
||||
Dependency dependency2 = Dependency.withId("conflict");
|
||||
DependenciesCapability capability = createDependenciesCapability("foo",
|
||||
@ -52,7 +52,7 @@ public class DependenciesCapabilityTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addDependencyWithAliases() {
|
||||
void addDependencyWithAliases() {
|
||||
Dependency dependency = Dependency.withId("first");
|
||||
dependency.getAliases().add("alias1");
|
||||
dependency.getAliases().add("alias2");
|
||||
@ -65,7 +65,7 @@ public class DependenciesCapabilityTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void aliasClashWithAnotherDependency() {
|
||||
void aliasClashWithAnotherDependency() {
|
||||
Dependency dependency = Dependency.withId("first");
|
||||
dependency.getAliases().add("alias1");
|
||||
dependency.getAliases().add("alias2");
|
||||
@ -79,7 +79,7 @@ public class DependenciesCapabilityTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mergeAddEntry() {
|
||||
void mergeAddEntry() {
|
||||
DependenciesCapability capability = createDependenciesCapability("foo",
|
||||
Dependency.withId("first"), Dependency.withId("second"));
|
||||
|
||||
@ -96,7 +96,7 @@ public class DependenciesCapabilityTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addDefaultVersionRange() {
|
||||
void addDefaultVersionRange() {
|
||||
Dependency first = Dependency.withId("first");
|
||||
Dependency second = Dependency.withId("second");
|
||||
second.setVersionRange("1.2.3.RELEASE");
|
||||
@ -112,7 +112,7 @@ public class DependenciesCapabilityTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addDefaultBom() {
|
||||
void addDefaultBom() {
|
||||
Dependency first = Dependency.withId("first");
|
||||
Dependency second = Dependency.withId("second");
|
||||
second.setBom("da-bom");
|
||||
@ -128,7 +128,7 @@ public class DependenciesCapabilityTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addDefaultRepository() {
|
||||
void addDefaultRepository() {
|
||||
Dependency first = Dependency.withId("first");
|
||||
Dependency second = Dependency.withId("second");
|
||||
second.setRepository("da-repo");
|
||||
|
@ -31,10 +31,10 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class DependencyTests {
|
||||
class DependencyTests {
|
||||
|
||||
@Test
|
||||
public void createRootSpringBootStarter() {
|
||||
void createRootSpringBootStarter() {
|
||||
Dependency d = new Dependency();
|
||||
d.asSpringBootStarter("");
|
||||
assertThat(d.getGroupId()).isEqualTo("org.springframework.boot");
|
||||
@ -42,7 +42,7 @@ public class DependencyTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setCoordinatesFromId() {
|
||||
void setCoordinatesFromId() {
|
||||
Dependency dependency = Dependency.withId("org.foo:bar:1.2.3");
|
||||
dependency.resolve();
|
||||
assertThat(dependency.getGroupId()).isEqualTo("org.foo");
|
||||
@ -52,7 +52,7 @@ public class DependencyTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setCoordinatesFromIdNoVersion() {
|
||||
void setCoordinatesFromIdNoVersion() {
|
||||
Dependency dependency = Dependency.withId("org.foo:bar");
|
||||
dependency.resolve();
|
||||
assertThat(dependency.getGroupId()).isEqualTo("org.foo");
|
||||
@ -62,7 +62,7 @@ public class DependencyTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setIdFromCoordinates() {
|
||||
void setIdFromCoordinates() {
|
||||
Dependency dependency = new Dependency();
|
||||
dependency.setGroupId("org.foo");
|
||||
dependency.setArtifactId("bar");
|
||||
@ -72,7 +72,7 @@ public class DependencyTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setIdFromCoordinatesNoVersion() {
|
||||
void setIdFromCoordinatesNoVersion() {
|
||||
Dependency dependency = new Dependency();
|
||||
dependency.setGroupId("org.foo");
|
||||
dependency.setArtifactId("bar");
|
||||
@ -81,7 +81,7 @@ public class DependencyTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setIdFromSimpleName() {
|
||||
void setIdFromSimpleName() {
|
||||
Dependency dependency = Dependency.withId("web");
|
||||
dependency.resolve();
|
||||
assertThat(dependency.getGroupId()).isEqualTo("org.springframework.boot");
|
||||
@ -91,13 +91,13 @@ public class DependencyTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void invalidDependency() {
|
||||
void invalidDependency() {
|
||||
assertThatExceptionOfType(InvalidInitializrMetadataException.class)
|
||||
.isThrownBy(() -> new Dependency().resolve());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void invalidDependencyScope() {
|
||||
void invalidDependencyScope() {
|
||||
Dependency dependency = Dependency.withId("web");
|
||||
assertThatExceptionOfType(InvalidInitializrMetadataException.class)
|
||||
.isThrownBy(() -> dependency.setScope("whatever"));
|
||||
@ -105,7 +105,7 @@ public class DependencyTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void invalidSpringBootRange() {
|
||||
void invalidSpringBootRange() {
|
||||
Dependency dependency = Dependency.withId("web");
|
||||
dependency.setVersionRange("A.B.C");
|
||||
assertThatExceptionOfType(InvalidInitializrMetadataException.class)
|
||||
@ -113,14 +113,14 @@ public class DependencyTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void invalidIdFormatTooManyColons() {
|
||||
void invalidIdFormatTooManyColons() {
|
||||
Dependency dependency = Dependency.withId("org.foo:bar:1.0:test:external");
|
||||
assertThatExceptionOfType(InvalidInitializrMetadataException.class)
|
||||
.isThrownBy(dependency::resolve);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void invalidLink() {
|
||||
void invalidLink() {
|
||||
Dependency dependency = Dependency.withId("foo");
|
||||
dependency.getLinks().add(Link.create(null, "https://example.com"));
|
||||
assertThatExceptionOfType(InvalidInitializrMetadataException.class)
|
||||
@ -128,21 +128,21 @@ public class DependencyTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generateIdWithNoGroupId() {
|
||||
void generateIdWithNoGroupId() {
|
||||
Dependency dependency = new Dependency();
|
||||
dependency.setArtifactId("bar");
|
||||
assertThatIllegalArgumentException().isThrownBy(dependency::generateId);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generateIdWithNoArtifactId() {
|
||||
void generateIdWithNoArtifactId() {
|
||||
Dependency dependency = new Dependency();
|
||||
dependency.setGroupId("foo");
|
||||
assertThatIllegalArgumentException().isThrownBy(dependency::generateId);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveNoMapping() {
|
||||
void resolveNoMapping() {
|
||||
Dependency dependency = Dependency.withId("web");
|
||||
dependency.resolve();
|
||||
assertThat(dependency.resolve(Version.parse("1.2.0.RELEASE")))
|
||||
@ -150,7 +150,7 @@ public class DependencyTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveInvalidMapping() {
|
||||
void resolveInvalidMapping() {
|
||||
Dependency dependency = Dependency.withId("web");
|
||||
dependency.getMappings()
|
||||
.add(Dependency.Mapping.create("foo-bar", null, null, "0.1.0.RELEASE"));
|
||||
@ -159,7 +159,7 @@ public class DependencyTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveVersionRequirement() {
|
||||
void resolveVersionRequirement() {
|
||||
Dependency dependency = Dependency.withId("web");
|
||||
dependency.getMappings().add(Dependency.Mapping
|
||||
.create("[1.1.0.RELEASE, 1.2.0.RELEASE)", null, null, "0.1.0.RELEASE"));
|
||||
@ -170,7 +170,7 @@ public class DependencyTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveMatchingVersionMapping() {
|
||||
void resolveMatchingVersionMapping() {
|
||||
Dependency dependency = Dependency.withId("web", null, null, "0.3.0.RELEASE");
|
||||
dependency.setDescription("A web dependency");
|
||||
dependency.getKeywords().addAll(Arrays.asList("foo", "bar"));
|
||||
@ -191,7 +191,7 @@ public class DependencyTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveMatchArtifactMapping() {
|
||||
void resolveMatchArtifactMapping() {
|
||||
Dependency dependency = Dependency.withId("web", null, null, "0.3.0.RELEASE");
|
||||
dependency.setDescription("A web dependency");
|
||||
dependency.getKeywords().addAll(Arrays.asList("foo", "bar"));
|
||||
@ -212,7 +212,7 @@ public class DependencyTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveMatchingVersionWithVariablePatch() {
|
||||
void resolveMatchingVersionWithVariablePatch() {
|
||||
Dependency dependency = Dependency.withId("web", null, null, "0.3.0.RELEASE");
|
||||
dependency.setDescription("A web dependency");
|
||||
dependency.getKeywords().addAll(Arrays.asList("foo", "bar"));
|
||||
@ -248,7 +248,7 @@ public class DependencyTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveMatchingWithCustomGroupId() {
|
||||
void resolveMatchingWithCustomGroupId() {
|
||||
Dependency dependency = Dependency.withId("foo", "com.acme", "foo",
|
||||
"0.3.0.RELEASE");
|
||||
dependency.getMappings().add(Dependency.Mapping
|
||||
@ -263,7 +263,7 @@ public class DependencyTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveVersionWithX() {
|
||||
void resolveVersionWithX() {
|
||||
Dependency dependency1 = Dependency.withId("foo1", "com.acme", "foo1",
|
||||
"0.3.0.RELEASE");
|
||||
dependency1.setVersionRange("1.2.x.RELEASE");
|
||||
@ -272,7 +272,7 @@ public class DependencyTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveVersionRangeWithX() {
|
||||
void resolveVersionRangeWithX() {
|
||||
Dependency dependency = Dependency.withId("foo1", "com.acme", "foo1",
|
||||
"0.3.0.RELEASE");
|
||||
dependency.setVersionRange("[1.1.0.RELEASE, 1.2.x.RELEASE)");
|
||||
|
@ -27,169 +27,169 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class InitializrConfigurationTests {
|
||||
class InitializrConfigurationTests {
|
||||
|
||||
private final InitializrConfiguration properties = new InitializrConfiguration();
|
||||
|
||||
@Test
|
||||
public void generateApplicationNameSimple() {
|
||||
void generateApplicationNameSimple() {
|
||||
assertThat(this.properties.generateApplicationName("demo"))
|
||||
.isEqualTo("DemoApplication");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generateApplicationNameSimpleApplication() {
|
||||
void generateApplicationNameSimpleApplication() {
|
||||
assertThat(this.properties.generateApplicationName("demoApplication"))
|
||||
.isEqualTo("DemoApplication");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generateApplicationNameSimpleCamelCase() {
|
||||
void generateApplicationNameSimpleCamelCase() {
|
||||
assertThat(this.properties.generateApplicationName("myDemo"))
|
||||
.isEqualTo("MyDemoApplication");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generateApplicationNameSimpleUnderscore() {
|
||||
void generateApplicationNameSimpleUnderscore() {
|
||||
assertThat(this.properties.generateApplicationName("my_demo"))
|
||||
.isEqualTo("MyDemoApplication");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generateApplicationNameSimpleColon() {
|
||||
void generateApplicationNameSimpleColon() {
|
||||
assertThat(this.properties.generateApplicationName("my:demo"))
|
||||
.isEqualTo("MyDemoApplication");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generateApplicationNameSimpleSpace() {
|
||||
void generateApplicationNameSimpleSpace() {
|
||||
assertThat(this.properties.generateApplicationName("my demo"))
|
||||
.isEqualTo("MyDemoApplication");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generateApplicationNameSimpleDash() {
|
||||
void generateApplicationNameSimpleDash() {
|
||||
assertThat(this.properties.generateApplicationName("my-demo"))
|
||||
.isEqualTo("MyDemoApplication");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generateApplicationNameUpperCaseUnderscore() {
|
||||
void generateApplicationNameUpperCaseUnderscore() {
|
||||
assertThat(this.properties.generateApplicationName("MY_DEMO"))
|
||||
.isEqualTo("MyDemoApplication");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generateApplicationNameUpperCaseDash() {
|
||||
void generateApplicationNameUpperCaseDash() {
|
||||
assertThat(this.properties.generateApplicationName("MY-DEMO"))
|
||||
.isEqualTo("MyDemoApplication");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generateApplicationNameMultiSpaces() {
|
||||
void generateApplicationNameMultiSpaces() {
|
||||
assertThat(this.properties.generateApplicationName(" my demo "))
|
||||
.isEqualTo("MyDemoApplication");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generateApplicationNameMultiSpacesUpperCase() {
|
||||
void generateApplicationNameMultiSpacesUpperCase() {
|
||||
assertThat("MyDemoApplication")
|
||||
.isEqualTo(this.properties.generateApplicationName(" MY DEMO "));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generateApplicationNameNull() {
|
||||
void generateApplicationNameNull() {
|
||||
assertThat(this.properties.generateApplicationName(null))
|
||||
.isEqualTo(this.properties.getEnv().getFallbackApplicationName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generateApplicationNameInvalidStartCharacter() {
|
||||
void generateApplicationNameInvalidStartCharacter() {
|
||||
assertThat(this.properties.generateApplicationName("1MyDemo"))
|
||||
.isEqualTo(this.properties.getEnv().getFallbackApplicationName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generateApplicationNameInvalidPartCharacter() {
|
||||
void generateApplicationNameInvalidPartCharacter() {
|
||||
assertThat(this.properties.generateApplicationName("MyDe|mo"))
|
||||
.isEqualTo(this.properties.getEnv().getFallbackApplicationName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generateApplicationNameInvalidApplicationName() {
|
||||
void generateApplicationNameInvalidApplicationName() {
|
||||
assertThat(this.properties.generateApplicationName("SpringBoot"))
|
||||
.isEqualTo(this.properties.getEnv().getFallbackApplicationName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generateApplicationNameAnotherInvalidApplicationName() {
|
||||
void generateApplicationNameAnotherInvalidApplicationName() {
|
||||
assertThat(this.properties.generateApplicationName("Spring"))
|
||||
.isEqualTo(this.properties.getEnv().getFallbackApplicationName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generatePackageNameSimple() {
|
||||
void generatePackageNameSimple() {
|
||||
assertThat(this.properties.cleanPackageName("com.foo", "com.example"))
|
||||
.isEqualTo("com.foo");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generatePackageNameSimpleUnderscore() {
|
||||
void generatePackageNameSimpleUnderscore() {
|
||||
assertThat(this.properties.cleanPackageName("com.my_foo", "com.example"))
|
||||
.isEqualTo("com.my_foo");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generatePackageNameSimpleColon() {
|
||||
void generatePackageNameSimpleColon() {
|
||||
assertThat(this.properties.cleanPackageName("com:foo", "com.example"))
|
||||
.isEqualTo("com.foo");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generatePackageNameMultipleDashers() {
|
||||
void generatePackageNameMultipleDashers() {
|
||||
assertThat(this.properties.cleanPackageName("com.foo--bar", "com.example"))
|
||||
.isEqualTo("com.foobar");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generatePackageNameMultipleSpaces() {
|
||||
void generatePackageNameMultipleSpaces() {
|
||||
assertThat(this.properties.cleanPackageName(" com foo ", "com.example"))
|
||||
.isEqualTo("com.foo");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generatePackageNameNull() {
|
||||
void generatePackageNameNull() {
|
||||
assertThat(this.properties.cleanPackageName(null, "com.example"))
|
||||
.isEqualTo("com.example");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generatePackageNameInvalidStartCharacter() {
|
||||
void generatePackageNameInvalidStartCharacter() {
|
||||
assertThat(this.properties.cleanPackageName("0com.foo", "com.example"))
|
||||
.isEqualTo("com.foo");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generatePackageNameVersion() {
|
||||
void generatePackageNameVersion() {
|
||||
assertThat(this.properties.cleanPackageName("com.foo.test-1.4.5", "com.example"))
|
||||
.isEqualTo("com.foo.test145");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generatePackageNameInvalidPackageName() {
|
||||
void generatePackageNameInvalidPackageName() {
|
||||
assertThat(this.properties.cleanPackageName("org.springframework", "com.example"))
|
||||
.isEqualTo("com.example");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validateArtifactRepository() {
|
||||
void validateArtifactRepository() {
|
||||
this.properties.getEnv().setArtifactRepository("http://foo/bar");
|
||||
assertThat(this.properties.getEnv().getArtifactRepository())
|
||||
.isEqualTo("http://foo/bar/");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveKotlinVersionMatchingMapping() {
|
||||
void resolveKotlinVersionMatchingMapping() {
|
||||
Kotlin kotlin = this.properties.getEnv().getKotlin();
|
||||
kotlin.setDefaultVersion("1.2.3");
|
||||
kotlin.getMappings()
|
||||
@ -201,7 +201,7 @@ public class InitializrConfigurationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveKotlinVersionUsingDefault() {
|
||||
void resolveKotlinVersionUsingDefault() {
|
||||
Kotlin kotlin = this.properties.getEnv().getKotlin();
|
||||
kotlin.setDefaultVersion("1.2.3");
|
||||
kotlin.getMappings()
|
||||
|
@ -36,10 +36,10 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class InitializrMetadataBuilderTests {
|
||||
class InitializrMetadataBuilderTests {
|
||||
|
||||
@Test
|
||||
public void loadDefaultConfig() {
|
||||
void loadDefaultConfig() {
|
||||
InitializrProperties bean = load(
|
||||
new ClassPathResource("application-test-default.yml"));
|
||||
InitializrMetadata metadata = InitializrMetadataBuilder
|
||||
@ -48,7 +48,7 @@ public class InitializrMetadataBuilderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mergeIdenticalConfig() {
|
||||
void mergeIdenticalConfig() {
|
||||
InitializrProperties bean = load(
|
||||
new ClassPathResource("application-test-default.yml"));
|
||||
InitializrMetadata metadata = InitializrMetadataBuilder
|
||||
@ -58,7 +58,7 @@ public class InitializrMetadataBuilderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mergeConfig() {
|
||||
void mergeConfig() {
|
||||
InitializrProperties config = load(
|
||||
new ClassPathResource("application-test-default.yml"));
|
||||
InitializrProperties customDefaultsConfig = load(
|
||||
@ -76,7 +76,7 @@ public class InitializrMetadataBuilderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mergeMetadata() {
|
||||
void mergeMetadata() {
|
||||
InitializrMetadata metadata = InitializrMetadataBuilder.create()
|
||||
.withInitializrMetadata(
|
||||
new ClassPathResource("metadata/config/test-min.json"))
|
||||
@ -101,7 +101,7 @@ public class InitializrMetadataBuilderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mergeMetadataWithBom() {
|
||||
void mergeMetadataWithBom() {
|
||||
InitializrMetadata metadata = InitializrMetadataBuilder.create()
|
||||
.withInitializrMetadata(
|
||||
new ClassPathResource("metadata/config/test-bom.json"))
|
||||
@ -124,7 +124,7 @@ public class InitializrMetadataBuilderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mergeMetadataWithRepository() throws Exception {
|
||||
void mergeMetadataWithRepository() throws Exception {
|
||||
InitializrMetadata metadata = InitializrMetadataBuilder.create()
|
||||
.withInitializrMetadata(
|
||||
new ClassPathResource("metadata/config/test-repository.json"))
|
||||
@ -147,7 +147,7 @@ public class InitializrMetadataBuilderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mergeConfigurationDisabledByDefault() {
|
||||
void mergeConfigurationDisabledByDefault() {
|
||||
InitializrProperties config = load(
|
||||
new ClassPathResource("application-test-default.yml"));
|
||||
InitializrProperties customDefaultsConfig = load(
|
||||
@ -167,7 +167,7 @@ public class InitializrMetadataBuilderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mergeConfiguration() {
|
||||
void mergeConfiguration() {
|
||||
InitializrProperties config = load(
|
||||
new ClassPathResource("application-test-default.yml"));
|
||||
InitializrProperties customDefaultsConfig = load(
|
||||
@ -188,7 +188,7 @@ public class InitializrMetadataBuilderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mergeSslConfiguration() {
|
||||
void mergeSslConfiguration() {
|
||||
InitializrProperties config = load(
|
||||
new ClassPathResource("application-test-default.yml"));
|
||||
InitializrProperties forceSslConfig = load(
|
||||
@ -202,7 +202,7 @@ public class InitializrMetadataBuilderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addDependencyInCustomizer() {
|
||||
void addDependencyInCustomizer() {
|
||||
DependencyGroup group = DependencyGroup.create("Extra");
|
||||
Dependency dependency = Dependency.withId("com.foo:foo:1.0.0");
|
||||
group.getContent().add(dependency);
|
||||
|
@ -31,10 +31,10 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
/**
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class InitializrMetadataTests {
|
||||
class InitializrMetadataTests {
|
||||
|
||||
@Test
|
||||
public void invalidBom() {
|
||||
void invalidBom() {
|
||||
Dependency foo = Dependency.withId("foo", "org.acme", "foo");
|
||||
foo.setBom("foo-bom");
|
||||
InitializrMetadataTestBuilder builder = InitializrMetadataTestBuilder
|
||||
@ -46,7 +46,7 @@ public class InitializrMetadataTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void invalidRepository() {
|
||||
void invalidRepository() {
|
||||
Dependency foo = Dependency.withId("foo", "org.acme", "foo");
|
||||
foo.setRepository("foo-repo");
|
||||
InitializrMetadataTestBuilder builder = InitializrMetadataTestBuilder
|
||||
@ -59,7 +59,7 @@ public class InitializrMetadataTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void invalidBomNoVersion() {
|
||||
void invalidBomNoVersion() {
|
||||
BillOfMaterials bom = BillOfMaterials.create("org.acme", "foo-bom");
|
||||
|
||||
InitializrMetadataTestBuilder builder = InitializrMetadataTestBuilder
|
||||
@ -70,7 +70,7 @@ public class InitializrMetadataTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void invalidBomUnknownRepository() {
|
||||
void invalidBomUnknownRepository() {
|
||||
BillOfMaterials bom = BillOfMaterials.create("org.acme", "foo-bom",
|
||||
"1.0.0.RELEASE");
|
||||
bom.getRepositories().add("foo-repo");
|
||||
@ -84,7 +84,7 @@ public class InitializrMetadataTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void invalidBomUnknownAdditionalBom() {
|
||||
void invalidBomUnknownAdditionalBom() {
|
||||
BillOfMaterials bom = BillOfMaterials.create("org.acme", "foo-bom",
|
||||
"1.0.0.RELEASE");
|
||||
bom.getAdditionalBoms().addAll(Arrays.asList("bar-bom", "biz-bom"));
|
||||
@ -100,7 +100,7 @@ public class InitializrMetadataTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void invalidBomVersionRangeMapping() {
|
||||
void invalidBomVersionRangeMapping() {
|
||||
BillOfMaterials bom = BillOfMaterials.create("org.acme", "foo-bom");
|
||||
bom.getMappings().add(Mapping.create("[1.2.0.RELEASE,1.3.0.M1)", "1.0.0"));
|
||||
bom.getMappings().add(Mapping.create("FOO_BAR", "1.2.0"));
|
||||
@ -113,7 +113,7 @@ public class InitializrMetadataTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void invalidBomVersionRangeMappingUnknownRepo() {
|
||||
void invalidBomVersionRangeMappingUnknownRepo() {
|
||||
BillOfMaterials bom = BillOfMaterials.create("org.acme", "foo-bom");
|
||||
bom.getMappings().add(Mapping.create("[1.0.0.RELEASE,1.3.0.M1)", "1.0.0"));
|
||||
Mapping mapping = Mapping.create("1.3.0.M2", "1.2.0");
|
||||
@ -129,7 +129,7 @@ public class InitializrMetadataTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void invalidBomVersionRangeMappingUnknownAdditionalBom() {
|
||||
void invalidBomVersionRangeMappingUnknownAdditionalBom() {
|
||||
BillOfMaterials bom = BillOfMaterials.create("org.acme", "foo-bom");
|
||||
bom.getMappings().add(Mapping.create("[1.0.0.RELEASE,1.3.0.M1)", "1.0.0"));
|
||||
Mapping mapping = Mapping.create("1.3.0.M2", "1.2.0");
|
||||
@ -145,7 +145,7 @@ public class InitializrMetadataTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateSpringBootVersions() {
|
||||
void updateSpringBootVersions() {
|
||||
BillOfMaterials bom = BillOfMaterials.create("org.acme", "foo-bom");
|
||||
bom.getMappings().add(Mapping.create("[1.2.0.RELEASE,1.3.x.RELEASE]", "1.0.0"));
|
||||
bom.getMappings()
|
||||
@ -184,7 +184,7 @@ public class InitializrMetadataTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void invalidParentMissingVersion() {
|
||||
void invalidParentMissingVersion() {
|
||||
InitializrMetadataTestBuilder builder = InitializrMetadataTestBuilder
|
||||
.withDefaults().setMavenParent("org.foo", "foo-parent", null, false);
|
||||
assertThatExceptionOfType(InvalidInitializrMetadataException.class)
|
||||
@ -193,7 +193,7 @@ public class InitializrMetadataTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void stripInvalidCharsFromPackage() {
|
||||
void stripInvalidCharsFromPackage() {
|
||||
InitializrMetadata metadata = InitializrMetadataTestBuilder.withDefaults()
|
||||
.build();
|
||||
metadata.getGroupId().setContent("org.acme");
|
||||
|
@ -32,10 +32,10 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class LinkTests {
|
||||
class LinkTests {
|
||||
|
||||
@Test
|
||||
public void resolveInvalidLinkNoRel() {
|
||||
void resolveInvalidLinkNoRel() {
|
||||
Link link = new Link();
|
||||
link.setHref("https://example.com");
|
||||
assertThatExceptionOfType(InvalidInitializrMetadataException.class)
|
||||
@ -43,14 +43,14 @@ public class LinkTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveInvalidLinkNoHref() {
|
||||
void resolveInvalidLinkNoHref() {
|
||||
Link link = Link.create("reference", null, "foo doc");
|
||||
assertThatExceptionOfType(InvalidInitializrMetadataException.class)
|
||||
.isThrownBy(link::resolve);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveLinkNoVariables() {
|
||||
void resolveLinkNoVariables() {
|
||||
Link link = Link.create("reference", "https://example.com/2");
|
||||
link.resolve();
|
||||
assertThat(link.isTemplated()).isFalse();
|
||||
@ -58,7 +58,7 @@ public class LinkTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveLinkWithVariables() {
|
||||
void resolveLinkWithVariables() {
|
||||
Link link = Link.create("reference", "https://example.com/{a}/2/{b}");
|
||||
link.resolve();
|
||||
assertThat(link.isTemplated()).isTrue();
|
||||
@ -66,7 +66,7 @@ public class LinkTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void expandLink() throws Exception {
|
||||
void expandLink() throws Exception {
|
||||
Link link = Link.create("reference", "https://example.com/{a}/2/{b}");
|
||||
link.resolve();
|
||||
Map<String, String> map = new LinkedHashMap<>();
|
||||
@ -77,7 +77,7 @@ public class LinkTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void expandLinkWithSameAttributeAtTwoPlaces() throws Exception {
|
||||
void expandLinkWithSameAttributeAtTwoPlaces() throws Exception {
|
||||
Link link = Link.create("reference", "https://example.com/{a}/2/{a}");
|
||||
link.resolve();
|
||||
Map<String, String> map = new LinkedHashMap<>();
|
||||
@ -88,7 +88,7 @@ public class LinkTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void expandLinkMissingVariable() {
|
||||
void expandLinkMissingVariable() {
|
||||
Link link = Link.create("reference", "https://example.com/{a}/2/{b}");
|
||||
link.resolve();
|
||||
assertThatIllegalArgumentException()
|
||||
|
@ -23,16 +23,16 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
/**
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class SingleSelectCapabilityTests {
|
||||
class SingleSelectCapabilityTests {
|
||||
|
||||
@Test
|
||||
public void defaultEmpty() {
|
||||
void defaultEmpty() {
|
||||
SingleSelectCapability capability = new SingleSelectCapability("test");
|
||||
assertThat(capability.getDefault()).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void defaultNoDefault() {
|
||||
void defaultNoDefault() {
|
||||
SingleSelectCapability capability = new SingleSelectCapability("test");
|
||||
capability.getContent().add(DefaultMetadataElement.create("foo", false));
|
||||
capability.getContent().add(DefaultMetadataElement.create("bar", false));
|
||||
@ -40,7 +40,7 @@ public class SingleSelectCapabilityTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void defaultType() {
|
||||
void defaultType() {
|
||||
SingleSelectCapability capability = new SingleSelectCapability("test");
|
||||
capability.getContent().add(DefaultMetadataElement.create("foo", false));
|
||||
DefaultMetadataElement second = DefaultMetadataElement.create("bar", true);
|
||||
@ -49,7 +49,7 @@ public class SingleSelectCapabilityTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mergeAddEntry() {
|
||||
void mergeAddEntry() {
|
||||
SingleSelectCapability capability = new SingleSelectCapability("test");
|
||||
DefaultMetadataElement foo = DefaultMetadataElement.create("foo", false);
|
||||
capability.getContent().add(foo);
|
||||
|
@ -23,10 +23,10 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
/**
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class TextCapabilityTests {
|
||||
class TextCapabilityTests {
|
||||
|
||||
@Test
|
||||
public void mergeValue() {
|
||||
void mergeValue() {
|
||||
TextCapability capability = new TextCapability("foo");
|
||||
capability.setContent("1234");
|
||||
TextCapability another = new TextCapability("foo");
|
||||
@ -38,7 +38,7 @@ public class TextCapabilityTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mergeTitle() {
|
||||
void mergeTitle() {
|
||||
TextCapability capability = new TextCapability("foo", "Foo", "my desc");
|
||||
capability.merge(new TextCapability("foo", "AnotherFoo", ""));
|
||||
assertThat(capability.getId()).isEqualTo("foo");
|
||||
@ -48,7 +48,7 @@ public class TextCapabilityTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mergeDescription() {
|
||||
void mergeDescription() {
|
||||
TextCapability capability = new TextCapability("foo", "Foo", "my desc");
|
||||
capability.merge(new TextCapability("foo", "", "another desc"));
|
||||
assertThat(capability.getId()).isEqualTo("foo");
|
||||
|
@ -23,16 +23,16 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
/**
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class TypeCapabilityTests {
|
||||
class TypeCapabilityTests {
|
||||
|
||||
@Test
|
||||
public void defaultEmpty() {
|
||||
void defaultEmpty() {
|
||||
TypeCapability capability = new TypeCapability();
|
||||
assertThat(capability.getDefault()).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void defaultNoDefault() {
|
||||
void defaultNoDefault() {
|
||||
TypeCapability capability = new TypeCapability();
|
||||
Type first = new Type();
|
||||
first.setId("foo");
|
||||
@ -46,7 +46,7 @@ public class TypeCapabilityTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void defaultType() {
|
||||
void defaultType() {
|
||||
TypeCapability capability = new TypeCapability();
|
||||
Type first = new Type();
|
||||
first.setId("foo");
|
||||
@ -60,7 +60,7 @@ public class TypeCapabilityTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mergeAddEntry() {
|
||||
void mergeAddEntry() {
|
||||
TypeCapability capability = new TypeCapability();
|
||||
Type first = new Type();
|
||||
first.setId("foo");
|
||||
|
@ -23,10 +23,10 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
/**
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class TypeTests {
|
||||
class TypeTests {
|
||||
|
||||
@Test
|
||||
public void parseAction() {
|
||||
void parseAction() {
|
||||
Type type = new Type();
|
||||
type.setId("foo");
|
||||
type.setAction("my-action.zip");
|
||||
|
@ -25,52 +25,52 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class AgentTests {
|
||||
class AgentTests {
|
||||
|
||||
@Test
|
||||
public void checkCurl() {
|
||||
void checkCurl() {
|
||||
Agent agent = Agent.fromUserAgent("curl/1.2.4");
|
||||
assertThat(agent.getId()).isEqualTo(Agent.AgentId.CURL);
|
||||
assertThat(agent.getVersion()).isEqualTo("1.2.4");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkHttpie() {
|
||||
void checkHttpie() {
|
||||
Agent agent = Agent.fromUserAgent("HTTPie/0.8.0");
|
||||
assertThat(agent.getId()).isEqualTo(Agent.AgentId.HTTPIE);
|
||||
assertThat(agent.getVersion()).isEqualTo("0.8.0");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkJBossForge() {
|
||||
void checkJBossForge() {
|
||||
Agent agent = Agent.fromUserAgent("SpringBootForgeCli/1.0.0.Alpha4");
|
||||
assertThat(agent.getId()).isEqualTo(Agent.AgentId.JBOSS_FORGE);
|
||||
assertThat(agent.getVersion()).isEqualTo("1.0.0.Alpha4");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkSpringBootCli() {
|
||||
void checkSpringBootCli() {
|
||||
Agent agent = Agent.fromUserAgent("SpringBootCli/1.3.1.RELEASE");
|
||||
assertThat(agent.getId()).isEqualTo(Agent.AgentId.SPRING_BOOT_CLI);
|
||||
assertThat(agent.getVersion()).isEqualTo("1.3.1.RELEASE");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkSts() {
|
||||
void checkSts() {
|
||||
Agent agent = Agent.fromUserAgent("STS 3.7.0.201506251244-RELEASE");
|
||||
assertThat(agent.getId()).isEqualTo(Agent.AgentId.STS);
|
||||
assertThat(agent.getVersion()).isEqualTo("3.7.0.201506251244-RELEASE");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkIntelliJIDEA() {
|
||||
void checkIntelliJIDEA() {
|
||||
Agent agent = Agent.fromUserAgent("IntelliJ IDEA");
|
||||
assertThat(agent.getId()).isEqualTo(Agent.AgentId.INTELLIJ_IDEA);
|
||||
assertThat(agent.getVersion()).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkIntelliJIDEAWithVersion() {
|
||||
void checkIntelliJIDEAWithVersion() {
|
||||
Agent agent = Agent
|
||||
.fromUserAgent("IntelliJ IDEA/144.2 (Community edition; en-us)");
|
||||
assertThat(agent.getId()).isEqualTo(Agent.AgentId.INTELLIJ_IDEA);
|
||||
@ -78,28 +78,28 @@ public class AgentTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkNetBeans() {
|
||||
void checkNetBeans() {
|
||||
Agent agent = Agent.fromUserAgent("nb-springboot-plugin/0.1");
|
||||
assertThat(agent.getId()).isEqualTo(Agent.AgentId.NETBEANS);
|
||||
assertThat(agent.getVersion()).isEqualTo("0.1");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkVsCode() {
|
||||
void checkVsCode() {
|
||||
Agent agent = Agent.fromUserAgent("vscode/0.2.0");
|
||||
assertThat(agent.getId()).isEqualTo(Agent.AgentId.VSCODE);
|
||||
assertThat(agent.getVersion()).isEqualTo("0.2.0");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkJenkinsX() {
|
||||
void checkJenkinsX() {
|
||||
Agent agent = Agent.fromUserAgent("jx/1.1.71");
|
||||
assertThat(agent.getId()).isEqualTo(Agent.AgentId.JENKINSX);
|
||||
assertThat(agent.getVersion()).isEqualTo("1.1.71");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkGenericBrowser() {
|
||||
void checkGenericBrowser() {
|
||||
Agent agent = Agent.fromUserAgent(
|
||||
"Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5 Build/MMB29K) ");
|
||||
assertThat(agent.getId()).isEqualTo(Agent.AgentId.BROWSER);
|
||||
@ -107,7 +107,7 @@ public class AgentTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkRobot() {
|
||||
void checkRobot() {
|
||||
Agent agent = Agent.fromUserAgent("Googlebot-Mobile");
|
||||
assertThat(agent).isNull();
|
||||
}
|
||||
|
@ -30,47 +30,47 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class VersionParserTests {
|
||||
class VersionParserTests {
|
||||
|
||||
private VersionParser parser = new VersionParser(Collections.emptyList());
|
||||
|
||||
@Test
|
||||
public void noQualifierString() {
|
||||
void noQualifierString() {
|
||||
Version version = this.parser.parse("1.2.0");
|
||||
assertThat(version.toString()).isEqualTo("1.2.0");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withQualifierString() {
|
||||
void withQualifierString() {
|
||||
Version version = this.parser.parse("1.2.0.RELEASE");
|
||||
assertThat(version.toString()).isEqualTo("1.2.0.RELEASE");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withQualifierAndVersionString() {
|
||||
void withQualifierAndVersionString() {
|
||||
Version version = this.parser.parse("1.2.0.RC2");
|
||||
assertThat(version.toString()).isEqualTo("1.2.0.RC2");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseInvalidVersion() {
|
||||
void parseInvalidVersion() {
|
||||
assertThatExceptionOfType(InvalidVersionException.class)
|
||||
.isThrownBy(() -> this.parser.parse("foo"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void safeParseInvalidVersion() {
|
||||
void safeParseInvalidVersion() {
|
||||
assertThat(this.parser.safeParse("foo")).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseVersionWithSpaces() {
|
||||
void parseVersionWithSpaces() {
|
||||
assertThat(this.parser.parse(" 1.2.0.RC3 "))
|
||||
.isLessThan(this.parser.parse("1.3.0.RELEASE"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseVariableVersionMatch() {
|
||||
void parseVariableVersionMatch() {
|
||||
List<Version> currentVersions = Arrays.asList(this.parser.parse("1.3.8.RELEASE"),
|
||||
this.parser.parse("1.3.9.BUILD-SNAPSHOT"));
|
||||
this.parser = new VersionParser(currentVersions);
|
||||
@ -79,7 +79,7 @@ public class VersionParserTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseVariableVersionNoPatchMatch() {
|
||||
void parseVariableVersionNoPatchMatch() {
|
||||
List<Version> currentVersions = Arrays.asList(this.parser.parse("1.3.8.RELEASE"),
|
||||
this.parser.parse("1.3.9.BUILD-SNAPSHOT"));
|
||||
this.parser = new VersionParser(currentVersions);
|
||||
@ -88,7 +88,7 @@ public class VersionParserTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseVariableVersionNoQualifierMatch() {
|
||||
void parseVariableVersionNoQualifierMatch() {
|
||||
List<Version> currentVersions = Arrays.asList(this.parser.parse("1.3.8.RELEASE"),
|
||||
this.parser.parse("1.4.0.BUILD-SNAPSHOT"));
|
||||
this.parser = new VersionParser(currentVersions);
|
||||
@ -97,7 +97,7 @@ public class VersionParserTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseVariableVersionNoMatch() {
|
||||
void parseVariableVersionNoMatch() {
|
||||
List<Version> currentVersions = Arrays.asList(this.parser.parse("1.3.8.RELEASE"),
|
||||
this.parser.parse("1.3.9.BUILD-SNAPSHOT"));
|
||||
this.parser = new VersionParser(currentVersions);
|
||||
@ -106,7 +106,7 @@ public class VersionParserTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseVariableVersionNoPatchNoMatch() {
|
||||
void parseVariableVersionNoPatchNoMatch() {
|
||||
List<Version> currentVersions = Arrays.asList(this.parser.parse("1.3.8.RELEASE"),
|
||||
this.parser.parse("1.3.9.BUILD-SNAPSHOT"));
|
||||
this.parser = new VersionParser(currentVersions);
|
||||
@ -115,7 +115,7 @@ public class VersionParserTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseVariableVersionNoQualifierNoMatch() {
|
||||
void parseVariableVersionNoQualifierNoMatch() {
|
||||
List<Version> currentVersions = Arrays.asList(this.parser.parse("1.3.8.RELEASE"),
|
||||
this.parser.parse("1.4.0.BUILD-SNAPSHOT"));
|
||||
this.parser = new VersionParser(currentVersions);
|
||||
@ -123,7 +123,7 @@ public class VersionParserTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void invalidRange() {
|
||||
void invalidRange() {
|
||||
assertThatExceptionOfType(InvalidVersionException.class)
|
||||
.isThrownBy(() -> this.parser.parseRange("foo-bar"));
|
||||
}
|
||||
|
@ -26,40 +26,40 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class VersionPropertyTests {
|
||||
class VersionPropertyTests {
|
||||
|
||||
@Test
|
||||
public void testStandardProperty() {
|
||||
void testStandardProperty() {
|
||||
assertThat(VersionProperty.of("spring-boot.version").toStandardFormat())
|
||||
.isEqualTo("spring-boot.version");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCamelCaseProperty() {
|
||||
void testCamelCaseProperty() {
|
||||
assertThat(VersionProperty.of("spring-boot.version").toCamelCaseFormat())
|
||||
.isEqualTo("springBootVersion");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStandardPropertyWithNoSeparator() {
|
||||
void testStandardPropertyWithNoSeparator() {
|
||||
assertThat(VersionProperty.of("springbootversion").toStandardFormat())
|
||||
.isEqualTo("springbootversion");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCamelCasePropertyWithNoSeparator() {
|
||||
void testCamelCasePropertyWithNoSeparator() {
|
||||
assertThat(VersionProperty.of("springbootversion").toCamelCaseFormat())
|
||||
.isEqualTo("springbootversion");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInvalidPropertyUpperCase() {
|
||||
void testInvalidPropertyUpperCase() {
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> VersionProperty.of("Spring-boot.version"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInvalidPropertyIllegalCharacter() {
|
||||
void testInvalidPropertyIllegalCharacter() {
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> VersionProperty.of("spring-boot_version"))
|
||||
.withMessageContaining("Unsupported character");
|
||||
|
@ -27,99 +27,99 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
/**
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class VersionRangeTests {
|
||||
class VersionRangeTests {
|
||||
|
||||
@Test
|
||||
public void simpleStartingRange() {
|
||||
void simpleStartingRange() {
|
||||
assertThat(new VersionRange(Version.parse("1.3.0.RELEASE")).toString())
|
||||
.isEqualTo(">=1.3.0.RELEASE");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void matchSimpleRange() {
|
||||
void matchSimpleRange() {
|
||||
assertThat("1.2.0.RC3").is(match("[1.2.0.RC1,1.2.0.RC5]"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void matchSimpleRangeBefore() {
|
||||
void matchSimpleRangeBefore() {
|
||||
assertThat("1.1.9.RC3").isNot(match("[1.2.0.RC1,1.2.0.RC5]"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void matchSimpleRangeAfter() {
|
||||
void matchSimpleRangeAfter() {
|
||||
assertThat("1.2.0.RC6").isNot(match("[1.2.0.RC1,1.2.0.RC5]"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void matchInclusiveLowerRange() {
|
||||
void matchInclusiveLowerRange() {
|
||||
assertThat("1.2.0.RC1").is(match("[1.2.0.RC1,1.2.0.RC5]"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void matchInclusiveHigherRange() {
|
||||
void matchInclusiveHigherRange() {
|
||||
assertThat("1.2.0.RC5").is(match("[1.2.0.RC1,1.2.0.RC5]"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void matchExclusiveLowerRange() {
|
||||
void matchExclusiveLowerRange() {
|
||||
assertThat("1.2.0.RC1").isNot(match("(1.2.0.RC1,1.2.0.RC5)"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void matchExclusiveHigherRange() {
|
||||
void matchExclusiveHigherRange() {
|
||||
assertThat("1.2.0.RC5").isNot(match("[1.2.0.RC1,1.2.0.RC5)"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void matchUnboundedRangeEqual() {
|
||||
void matchUnboundedRangeEqual() {
|
||||
assertThat("1.2.0.RELEASE").is(match("1.2.0.RELEASE"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void matchUnboundedRangeAfter() {
|
||||
void matchUnboundedRangeAfter() {
|
||||
assertThat("2.2.0.RELEASE").is(match("1.2.0.RELEASE"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void matchUnboundedRangeBefore() {
|
||||
void matchUnboundedRangeBefore() {
|
||||
assertThat("1.1.9.RELEASE").isNot(match("1.2.0.RELEASE"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rangeWithSpaces() {
|
||||
void rangeWithSpaces() {
|
||||
assertThat("1.2.0.RC3").is(match("[ 1.2.0.RC1 , 1.2.0.RC5]"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void matchLatestVersion() {
|
||||
void matchLatestVersion() {
|
||||
assertThat("1.2.8.RELEASE").is(match("[1.2.0.RELEASE,1.2.x.BUILD-SNAPSHOT]",
|
||||
new VersionParser(Collections
|
||||
.singletonList(Version.parse("1.2.9.BUILD-SNAPSHOT")))));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void matchOverLatestVersion() {
|
||||
void matchOverLatestVersion() {
|
||||
assertThat("1.2.10.RELEASE").isNot(match("[1.2.0.RELEASE,1.2.x.BUILD-SNAPSHOT]",
|
||||
new VersionParser(Collections
|
||||
.singletonList(Version.parse("1.2.9.BUILD-SNAPSHOT")))));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void matchAsOfCurrentVersion() {
|
||||
void matchAsOfCurrentVersion() {
|
||||
assertThat("1.3.5.RELEASE").is(match("[1.3.x.RELEASE,1.3.x.BUILD-SNAPSHOT]",
|
||||
new VersionParser(Arrays.asList(Version.parse("1.3.4.RELEASE"),
|
||||
Version.parse("1.3.6.BUILD-SNAPSHOT")))));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void matchOverAsOfCurrentVersion() {
|
||||
void matchOverAsOfCurrentVersion() {
|
||||
assertThat("1.3.5.RELEASE").isNot(match("[1.3.x.RELEASE,1.3.x.BUILD-SNAPSHOT]",
|
||||
new VersionParser(Arrays.asList(Version.parse("1.3.7.RELEASE"),
|
||||
Version.parse("1.3.6.BUILD-SNAPSHOT")))));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void toVersionRangeWithSimpleVersion() {
|
||||
void toVersionRangeWithSimpleVersion() {
|
||||
VersionRange range = new VersionParser(
|
||||
Collections.singletonList(Version.parse("1.5.6.RELEASE")))
|
||||
.parseRange("1.3.5.RELEASE");
|
||||
@ -127,7 +127,7 @@ public class VersionRangeTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void toVersionRangeWithVersionsIncluded() {
|
||||
void toVersionRangeWithVersionsIncluded() {
|
||||
VersionRange range = new VersionParser(
|
||||
Collections.singletonList(Version.parse("1.5.6.RELEASE")))
|
||||
.parseRange("[1.3.5.RELEASE,1.5.5.RELEASE]");
|
||||
@ -135,7 +135,7 @@ public class VersionRangeTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void toVersionRangeWithLowerVersionExcluded() {
|
||||
void toVersionRangeWithLowerVersionExcluded() {
|
||||
VersionRange range = new VersionParser(
|
||||
Collections.singletonList(Version.parse("1.5.6.RELEASE")))
|
||||
.parseRange("(1.3.5.RELEASE,1.5.5.RELEASE]");
|
||||
@ -143,7 +143,7 @@ public class VersionRangeTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void toVersionRangeWithHigherVersionExcluded() {
|
||||
void toVersionRangeWithHigherVersionExcluded() {
|
||||
VersionRange range = new VersionParser(
|
||||
Collections.singletonList(Version.parse("1.5.6.RELEASE")))
|
||||
.parseRange("[1.3.5.RELEASE,1.5.5.RELEASE)");
|
||||
@ -151,7 +151,7 @@ public class VersionRangeTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void toVersionRangeWithVersionsExcluded() {
|
||||
void toVersionRangeWithVersionsExcluded() {
|
||||
VersionRange range = new VersionParser(
|
||||
Collections.singletonList(Version.parse("1.5.6.RELEASE")))
|
||||
.parseRange("(1.3.5.RELEASE,1.5.5.RELEASE)");
|
||||
|
@ -25,12 +25,12 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
/**
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class VersionTests {
|
||||
class VersionTests {
|
||||
|
||||
private final VersionParser parser = new VersionParser(Collections.emptyList());
|
||||
|
||||
@Test
|
||||
public void equalNoQualifier() {
|
||||
void equalNoQualifier() {
|
||||
Version first = parse("1.2.0");
|
||||
Version second = parse("1.2.0");
|
||||
assertThat(first).isEqualByComparingTo(second);
|
||||
@ -38,7 +38,7 @@ public class VersionTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void equalQualifierNoVersion() {
|
||||
void equalQualifierNoVersion() {
|
||||
Version first = parse("1.2.0.RELEASE");
|
||||
Version second = parse("1.2.0.RELEASE");
|
||||
assertThat(first).isEqualByComparingTo(second);
|
||||
@ -46,7 +46,7 @@ public class VersionTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void equalQualifierVersion() {
|
||||
void equalQualifierVersion() {
|
||||
Version first = parse("1.2.0.RC1");
|
||||
Version second = parse("1.2.0.RC1");
|
||||
assertThat(first).isEqualByComparingTo(second);
|
||||
@ -54,72 +54,72 @@ public class VersionTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void compareMajorOnly() {
|
||||
void compareMajorOnly() {
|
||||
assertThat(parse("2.2.0")).isGreaterThan(parse("1.8.0"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void compareMinorOnly() {
|
||||
void compareMinorOnly() {
|
||||
assertThat(parse("2.2.0")).isGreaterThan(parse("2.1.9"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void comparePatchOnly() {
|
||||
void comparePatchOnly() {
|
||||
assertThat(parse("2.2.4")).isGreaterThan(parse("2.2.3"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void compareHigherVersion() {
|
||||
void compareHigherVersion() {
|
||||
assertThat(parse("1.2.0.RELEASE")).isGreaterThan(parse("1.1.9.RELEASE"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void compareHigherQualifier() {
|
||||
void compareHigherQualifier() {
|
||||
assertThat(parse("1.2.0.RC1")).isGreaterThan(parse("1.2.0.M1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void compareHigherQualifierVersion() {
|
||||
void compareHigherQualifierVersion() {
|
||||
assertThat(parse("1.2.0.RC2")).isGreaterThan(parse("1.2.0.RC1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void compareLowerVersion() {
|
||||
void compareLowerVersion() {
|
||||
assertThat(parse("1.0.5.RELEASE")).isLessThan(parse("1.1.9.RELEASE"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void compareLowerQualifier() {
|
||||
void compareLowerQualifier() {
|
||||
assertThat(parse("1.2.0.RC1")).isLessThan(parse("1.2.0.RELEASE"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void compareLessQualifierVersion() {
|
||||
void compareLessQualifierVersion() {
|
||||
assertThat(parse("1.2.0.RC2")).isLessThan(parse("1.2.0.RC3"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void compareWithNull() {
|
||||
void compareWithNull() {
|
||||
assertThat(parse("1.2.0.RC2")).isGreaterThan(null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void compareUnknownQualifier() {
|
||||
void compareUnknownQualifier() {
|
||||
assertThat(parse("1.2.0.Beta")).isLessThan(parse("1.2.0.CR"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void compareUnknownQualifierVersion() {
|
||||
void compareUnknownQualifierVersion() {
|
||||
assertThat(parse("1.2.0.Beta1")).isLessThan(parse("1.2.0.Beta2"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void snapshotGreaterThanRC() {
|
||||
void snapshotGreaterThanRC() {
|
||||
assertThat(parse("1.2.0.BUILD-SNAPSHOT")).isGreaterThan(parse("1.2.0.RC1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void snapshotLowerThanRelease() {
|
||||
void snapshotLowerThanRelease() {
|
||||
assertThat(parse("1.2.0.BUILD-SNAPSHOT")).isLessThan(parse("1.2.0.RELEASE"));
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
/**
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class CloudfoundryEnvironmentPostProcessorTests {
|
||||
class CloudfoundryEnvironmentPostProcessorTests {
|
||||
|
||||
private final CloudfoundryEnvironmentPostProcessor postProcessor = new CloudfoundryEnvironmentPostProcessor();
|
||||
|
||||
@ -35,7 +35,7 @@ public class CloudfoundryEnvironmentPostProcessorTests {
|
||||
private final SpringApplication application = new SpringApplication();
|
||||
|
||||
@Test
|
||||
public void parseUriWithCredentials() {
|
||||
void parseUriWithCredentials() {
|
||||
this.environment.setProperty("vcap.services.stats-index.credentials.uri",
|
||||
"https://user:pass@example.com/bar/biz?param=one");
|
||||
this.postProcessor.postProcessEnvironment(this.environment, this.application);
|
||||
@ -49,7 +49,7 @@ public class CloudfoundryEnvironmentPostProcessorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseUri() {
|
||||
void parseUri() {
|
||||
this.environment.setProperty("vcap.services.stats-index.credentials.uri",
|
||||
"http://example.com/bar/biz?param=one");
|
||||
this.postProcessor.postProcessEnvironment(this.environment, this.application);
|
||||
@ -63,7 +63,7 @@ public class CloudfoundryEnvironmentPostProcessorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseNoVcapUri() {
|
||||
void parseNoVcapUri() {
|
||||
this.postProcessor.postProcessEnvironment(this.environment, this.application);
|
||||
|
||||
assertThat(this.environment.getProperty("initializr.stats.elastic.uri")).isNull();
|
||||
|
@ -52,20 +52,20 @@ import static org.mockito.Mockito.mock;
|
||||
* @author Stephane Nicoll
|
||||
* @author Madhura Bhave
|
||||
*/
|
||||
public class InitializrAutoConfigurationTests {
|
||||
class InitializrAutoConfigurationTests {
|
||||
|
||||
private ApplicationContextRunner contextRunner = new ApplicationContextRunner()
|
||||
.withConfiguration(AutoConfigurations.of(RestTemplateAutoConfiguration.class,
|
||||
JacksonAutoConfiguration.class, InitializrAutoConfiguration.class));
|
||||
|
||||
@Test
|
||||
public void autoConfigRegistersProjectGenerator() {
|
||||
void autoConfigRegistersProjectGenerator() {
|
||||
this.contextRunner.run(
|
||||
(context) -> assertThat(context).hasSingleBean(ProjectGenerator.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void autoConfigWhenProjectGeneratorBeanPresentDoesNotRegisterProjectGenerator() {
|
||||
void autoConfigWhenProjectGeneratorBeanPresentDoesNotRegisterProjectGenerator() {
|
||||
this.contextRunner
|
||||
.withUserConfiguration(CustomProjectGeneratorConfiguration.class)
|
||||
.run((context) -> {
|
||||
@ -75,13 +75,13 @@ public class InitializrAutoConfigurationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void autoConfigRegistersTemplateRenderer() {
|
||||
void autoConfigRegistersTemplateRenderer() {
|
||||
this.contextRunner.run(
|
||||
(context) -> assertThat(context).hasSingleBean(TemplateRenderer.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void autoConfigWhenTemplateRendererBeanPresentDoesNotRegisterTemplateRenderer() {
|
||||
void autoConfigWhenTemplateRendererBeanPresentDoesNotRegisterTemplateRenderer() {
|
||||
this.contextRunner
|
||||
.withUserConfiguration(CustomTemplateRendererConfiguration.class)
|
||||
.run((context) -> {
|
||||
@ -91,13 +91,13 @@ public class InitializrAutoConfigurationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void autoConfigRegistersProjectRequestResolver() {
|
||||
void autoConfigRegistersProjectRequestResolver() {
|
||||
this.contextRunner.run((context) -> assertThat(context)
|
||||
.hasSingleBean(ProjectRequestResolver.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void autoConfigWhenProjectRequestResolverBeanPresentDoesNotRegisterProjectRequestResolver() {
|
||||
void autoConfigWhenProjectRequestResolverBeanPresentDoesNotRegisterProjectRequestResolver() {
|
||||
this.contextRunner
|
||||
.withUserConfiguration(CustomProjectRequestResolverConfiguration.class)
|
||||
.run((context) -> {
|
||||
@ -107,13 +107,13 @@ public class InitializrAutoConfigurationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void autoConfigRegistersProjectResourceLocator() {
|
||||
void autoConfigRegistersProjectResourceLocator() {
|
||||
this.contextRunner.run((context) -> assertThat(context)
|
||||
.hasSingleBean(ProjectResourceLocator.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void autoConfigWhenProjectResourceLocatorBeanPresentDoesNotRegisterProjectResourceLocator() {
|
||||
void autoConfigWhenProjectResourceLocatorBeanPresentDoesNotRegisterProjectResourceLocator() {
|
||||
this.contextRunner
|
||||
.withUserConfiguration(CustomProjectResourceLocatorConfiguration.class)
|
||||
.run((context) -> {
|
||||
@ -123,13 +123,13 @@ public class InitializrAutoConfigurationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void autoConfigRegistersInitializrMetadataProvider() {
|
||||
void autoConfigRegistersInitializrMetadataProvider() {
|
||||
this.contextRunner.run((context) -> assertThat(context)
|
||||
.hasSingleBean(InitializrMetadataProvider.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void autoConfigWhenInitializrMetadataProviderBeanPresentDoesNotRegisterInitializrMetadataProvider() {
|
||||
void autoConfigWhenInitializrMetadataProviderBeanPresentDoesNotRegisterInitializrMetadataProvider() {
|
||||
this.contextRunner
|
||||
.withUserConfiguration(
|
||||
CustomInitializrMetadataProviderConfiguration.class)
|
||||
@ -140,13 +140,13 @@ public class InitializrAutoConfigurationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void autoConfigRegistersDependencyMetadataProvider() {
|
||||
void autoConfigRegistersDependencyMetadataProvider() {
|
||||
this.contextRunner.run((context) -> assertThat(context)
|
||||
.hasSingleBean(DependencyMetadataProvider.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void autoConfigWhenDependencyMetadataProviderBeanPresentDoesNotRegisterDependencyMetadataProvider() {
|
||||
void autoConfigWhenDependencyMetadataProviderBeanPresentDoesNotRegisterDependencyMetadataProvider() {
|
||||
this.contextRunner
|
||||
.withUserConfiguration(
|
||||
CustomDependencyMetadataProviderConfiguration.class)
|
||||
@ -157,7 +157,7 @@ public class InitializrAutoConfigurationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void customRestTemplateBuilderIsUsed() {
|
||||
void customRestTemplateBuilderIsUsed() {
|
||||
this.contextRunner.withUserConfiguration(CustomRestTemplateConfiguration.class)
|
||||
.run((context) -> {
|
||||
assertThat(context).hasSingleBean(InitializrMetadataProvider.class);
|
||||
@ -170,7 +170,7 @@ public class InitializrAutoConfigurationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void webConfiguration() {
|
||||
void webConfiguration() {
|
||||
WebApplicationContextRunner webContextRunner = new WebApplicationContextRunner()
|
||||
.withConfiguration(
|
||||
AutoConfigurations.of(RestTemplateAutoConfiguration.class,
|
||||
@ -186,7 +186,7 @@ public class InitializrAutoConfigurationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void webConfigurationConditionalOnWebApplication() {
|
||||
void webConfigurationConditionalOnWebApplication() {
|
||||
this.contextRunner.run((context) -> {
|
||||
assertThat(context).doesNotHaveBean(InitializrWebConfig.class);
|
||||
assertThat(context).doesNotHaveBean(MainController.class);
|
||||
@ -195,13 +195,13 @@ public class InitializrAutoConfigurationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void cacheConfiguration() {
|
||||
void cacheConfiguration() {
|
||||
this.contextRunner.run((context) -> assertThat(context)
|
||||
.hasSingleBean(JCacheManagerCustomizer.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void cacheConfigurationConditionalOnClass() {
|
||||
void cacheConfigurationConditionalOnClass() {
|
||||
this.contextRunner
|
||||
.withClassLoader(new FilteredClassLoader("javax.cache.CacheManager"))
|
||||
.run((context) -> assertThat(context)
|
||||
|
@ -32,12 +32,12 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
/**
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class DependencyMetadataJsonMapperTests {
|
||||
class DependencyMetadataJsonMapperTests {
|
||||
|
||||
private final DependencyMetadataJsonMapper mapper = new DependencyMetadataV21JsonMapper();
|
||||
|
||||
@Test
|
||||
public void mapDependency() throws Exception {
|
||||
void mapDependency() throws Exception {
|
||||
Dependency d = Dependency.withId("foo", "org.foo", "foo");
|
||||
d.setRepository("my-repo");
|
||||
d.setBom("my-bom");
|
||||
|
@ -31,14 +31,14 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
/**
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class InitializrMetadataJsonMapperTests {
|
||||
class InitializrMetadataJsonMapperTests {
|
||||
|
||||
private static final ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
private final InitializrMetadataJsonMapper jsonMapper = new InitializrMetadataV21JsonMapper();
|
||||
|
||||
@Test
|
||||
public void withNoAppUrl() throws IOException {
|
||||
void withNoAppUrl() throws IOException {
|
||||
InitializrMetadata metadata = new InitializrMetadataTestBuilder()
|
||||
.addType("foo", true, "/foo.zip", "none", "test")
|
||||
.addDependencyGroup("foo", "one", "two").build();
|
||||
@ -50,7 +50,7 @@ public class InitializrMetadataJsonMapperTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withAppUrl() throws IOException {
|
||||
void withAppUrl() throws IOException {
|
||||
InitializrMetadata metadata = new InitializrMetadataTestBuilder()
|
||||
.addType("foo", true, "/foo.zip", "none", "test")
|
||||
.addDependencyGroup("foo", "one", "two").build();
|
||||
@ -62,7 +62,7 @@ public class InitializrMetadataJsonMapperTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void linksRendered() {
|
||||
void linksRendered() {
|
||||
Dependency dependency = Dependency.withId("foo", "com.example", "foo");
|
||||
dependency.getLinks().add(Link.create("guide", "https://example.com/how-to"));
|
||||
dependency.getLinks().add(Link.create("reference", "https://example.com/doc"));
|
||||
|
@ -31,10 +31,10 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class LinkMapperTests {
|
||||
class LinkMapperTests {
|
||||
|
||||
@Test
|
||||
public void mapSimpleRel() {
|
||||
void mapSimpleRel() {
|
||||
List<Link> links = new ArrayList<>();
|
||||
links.add(Link.create("a", "https://example.com", "some description"));
|
||||
ObjectNode model = LinkMapper.mapLinks(links);
|
||||
@ -47,7 +47,7 @@ public class LinkMapperTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mapTemplatedRel() {
|
||||
void mapTemplatedRel() {
|
||||
List<Link> links = new ArrayList<>();
|
||||
links.add(Link.create("a", "https://example.com/{bootVersion}/a", true));
|
||||
ObjectNode model = LinkMapper.mapLinks(links);
|
||||
@ -61,7 +61,7 @@ public class LinkMapperTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mergeSeveralLinksInArray() {
|
||||
void mergeSeveralLinksInArray() {
|
||||
List<Link> links = new ArrayList<>();
|
||||
links.add(Link.create("a", "https://example.com", "some description"));
|
||||
links.add(Link.create("a", "https://example.com/2"));
|
||||
@ -77,7 +77,7 @@ public class LinkMapperTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void keepOrdering() {
|
||||
void keepOrdering() {
|
||||
List<Link> links = new ArrayList<>();
|
||||
links.add(Link.create("first", "https://example.com"));
|
||||
links.add(Link.create("second", "https://example.com"));
|
||||
@ -87,7 +87,7 @@ public class LinkMapperTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void keepOrderingWithMultipleUrlForSameRel() {
|
||||
void keepOrderingWithMultipleUrlForSameRel() {
|
||||
List<Link> links = new ArrayList<>();
|
||||
links.add(Link.create("first", "https://example.com"));
|
||||
links.add(Link.create("second", "https://example.com"));
|
||||
|
@ -32,11 +32,11 @@ import org.springframework.test.context.ActiveProfiles;
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
@ActiveProfiles("test-default")
|
||||
public class CommandLineExampleIntegrationTests
|
||||
class CommandLineExampleIntegrationTests
|
||||
extends AbstractInitializrControllerIntegrationTests {
|
||||
|
||||
@Test
|
||||
public void generateDefaultProject() {
|
||||
void generateDefaultProject() {
|
||||
downloadZip("/starter.zip").isJavaProject().isMavenProject()
|
||||
.hasStaticAndTemplatesResources(false).pomAssert()
|
||||
.hasSpringBootStarterRootDependency().hasSpringBootStarterTest()
|
||||
@ -44,7 +44,7 @@ public class CommandLineExampleIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generateWebProjectWithJava8() {
|
||||
void generateWebProjectWithJava8() {
|
||||
downloadZip("/starter.zip?dependencies=web&javaVersion=1.8").isJavaProject()
|
||||
.isMavenProject().hasStaticAndTemplatesResources(true).pomAssert()
|
||||
.hasJavaVersion("1.8").hasSpringBootStarterDependency("web")
|
||||
@ -52,7 +52,7 @@ public class CommandLineExampleIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generateWebDataJpaGradleProject() {
|
||||
void generateWebDataJpaGradleProject() {
|
||||
downloadTgz(
|
||||
"/starter.tgz?dependencies=web,data-jpa&type=gradle-project&baseDir=my-dir")
|
||||
.hasBaseDir("my-dir").isJavaProject().isGradleProject()
|
||||
@ -62,7 +62,7 @@ public class CommandLineExampleIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generateMavenPomWithWarPackaging() {
|
||||
void generateMavenPomWithWarPackaging() {
|
||||
ResponseEntity<String> response = getRestTemplate()
|
||||
.getForEntity(createUrl("/pom.xml?packaging=war"), String.class);
|
||||
PomAssert pomAssert = new PomAssert(response.getBody());
|
||||
|
@ -28,13 +28,13 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
@ActiveProfiles({ "test-default", "test-custom-defaults" })
|
||||
public class MainControllerDefaultsIntegrationTests
|
||||
class MainControllerDefaultsIntegrationTests
|
||||
extends AbstractInitializrControllerIntegrationTests {
|
||||
|
||||
// see defaults customization
|
||||
|
||||
@Test
|
||||
public void generateDefaultPom() {
|
||||
void generateDefaultPom() {
|
||||
String content = getRestTemplate().getForObject(createUrl("/pom.xml?style=web"),
|
||||
String.class);
|
||||
PomAssert pomAssert = new PomAssert(content);
|
||||
@ -44,7 +44,7 @@ public class MainControllerDefaultsIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void defaultsAppliedToHome() {
|
||||
void defaultsAppliedToHome() {
|
||||
String body = htmlHome();
|
||||
assertThat(body).as("custom groupId not found").contains("org.foo");
|
||||
assertThat(body).as("custom artifactId not found").contains("foo-bar");
|
||||
|
@ -33,11 +33,11 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
@ActiveProfiles("test-default")
|
||||
public class MainControllerDependenciesTests
|
||||
class MainControllerDependenciesTests
|
||||
extends AbstractInitializrControllerIntegrationTests {
|
||||
|
||||
@Test
|
||||
public void noBootVersion() throws JSONException {
|
||||
void noBootVersion() throws JSONException {
|
||||
ResponseEntity<String> response = execute("/dependencies", String.class, null,
|
||||
"application/json");
|
||||
assertThat(response.getHeaders().getFirst(HttpHeaders.ETAG)).isNotNull();
|
||||
@ -46,7 +46,7 @@ public class MainControllerDependenciesTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void filteredDependencies() throws JSONException {
|
||||
void filteredDependencies() throws JSONException {
|
||||
ResponseEntity<String> response = execute(
|
||||
"/dependencies?bootVersion=2.2.1.RELEASE", String.class, null,
|
||||
"application/json");
|
||||
|
@ -34,11 +34,11 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
@ActiveProfiles({ "test-default", "test-custom-env" })
|
||||
public class MainControllerEnvIntegrationTests
|
||||
class MainControllerEnvIntegrationTests
|
||||
extends AbstractInitializrControllerIntegrationTests {
|
||||
|
||||
@Test
|
||||
public void downloadCliWithCustomRepository() throws Exception {
|
||||
void downloadCliWithCustomRepository() throws Exception {
|
||||
ResponseEntity<?> entity = getRestTemplate().getForEntity(createUrl("/spring"),
|
||||
String.class);
|
||||
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.FOUND);
|
||||
@ -47,7 +47,7 @@ public class MainControllerEnvIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generateProjectWithInvalidName() {
|
||||
void generateProjectWithInvalidName() {
|
||||
downloadZip("/starter.zip?style=data-jpa&name=Invalid")
|
||||
.isJavaProject(ProjectAssert.DEFAULT_PACKAGE_NAME, "FooBarApplication")
|
||||
.isMavenProject().hasStaticAndTemplatesResources(false).pomAssert()
|
||||
@ -56,7 +56,7 @@ public class MainControllerEnvIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void googleAnalytics() {
|
||||
void googleAnalytics() {
|
||||
String body = htmlHome();
|
||||
assertThat(body).contains("https://www.googletagmanager.com/gtm.js");
|
||||
}
|
||||
|
@ -43,11 +43,11 @@ import static org.assertj.core.api.Assertions.fail;
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
@ActiveProfiles("test-default")
|
||||
public class MainControllerIntegrationTests
|
||||
class MainControllerIntegrationTests
|
||||
extends AbstractInitializrControllerIntegrationTests {
|
||||
|
||||
@Test
|
||||
public void simpleZipProject() {
|
||||
void simpleZipProject() {
|
||||
downloadZip("/starter.zip?style=web&style=jpa").isJavaProject()
|
||||
.hasFile(".gitignore").hasExecutableFile("mvnw").isMavenProject()
|
||||
.hasStaticAndTemplatesResources(true).pomAssert().hasDependenciesCount(3)
|
||||
@ -57,7 +57,7 @@ public class MainControllerIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void simpleTgzProject() {
|
||||
void simpleTgzProject() {
|
||||
downloadTgz("/starter.tgz?style=org.acme:foo").isJavaProject()
|
||||
.hasFile(".gitignore").hasExecutableFile("mvnw").isMavenProject()
|
||||
.hasStaticAndTemplatesResources(false).pomAssert().hasDependenciesCount(2)
|
||||
@ -65,7 +65,7 @@ public class MainControllerIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void dependencyInRange() {
|
||||
void dependencyInRange() {
|
||||
Dependency biz = Dependency.create("org.acme", "biz", "1.3.5", "runtime");
|
||||
downloadTgz("/starter.tgz?style=org.acme:biz&bootVersion=2.2.1.RELEASE")
|
||||
.isJavaProject().isMavenProject().hasStaticAndTemplatesResources(false)
|
||||
@ -73,7 +73,7 @@ public class MainControllerIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void dependencyNotInRange() {
|
||||
void dependencyNotInRange() {
|
||||
try {
|
||||
execute("/starter.tgz?style=org.acme:bur", byte[].class, null,
|
||||
(String[]) null);
|
||||
@ -84,7 +84,7 @@ public class MainControllerIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void noDependencyProject() {
|
||||
void noDependencyProject() {
|
||||
downloadZip("/starter.zip").isJavaProject().isMavenProject()
|
||||
.hasStaticAndTemplatesResources(false).pomAssert().hasDependenciesCount(2)
|
||||
// the root dep is added if none is specified
|
||||
@ -92,7 +92,7 @@ public class MainControllerIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void dependenciesIsAnAliasOfStyle() {
|
||||
void dependenciesIsAnAliasOfStyle() {
|
||||
downloadZip("/starter.zip?dependencies=web&dependencies=jpa").isJavaProject()
|
||||
.isMavenProject().hasStaticAndTemplatesResources(true).pomAssert()
|
||||
.hasDependenciesCount(3).hasSpringBootStarterDependency("web")
|
||||
@ -101,7 +101,7 @@ public class MainControllerIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void dependenciesIsAnAliasOfStyleCommaSeparated() {
|
||||
void dependenciesIsAnAliasOfStyleCommaSeparated() {
|
||||
downloadZip("/starter.zip?dependencies=web,jpa").isJavaProject().isMavenProject()
|
||||
.hasStaticAndTemplatesResources(true).pomAssert().hasDependenciesCount(3)
|
||||
.hasSpringBootStarterDependency("web")
|
||||
@ -110,35 +110,35 @@ public class MainControllerIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void kotlinRange() {
|
||||
void kotlinRange() {
|
||||
downloadZip("/starter.zip?style=web&language=kotlin&bootVersion=2.0.1.RELEASE")
|
||||
.isKotlinProject().isMavenProject().pomAssert().hasDependenciesCount(4)
|
||||
.hasProperty("kotlin.version", "1.1");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void gradleWarProject() {
|
||||
void gradleWarProject() {
|
||||
downloadZip("/starter.zip?style=web&style=security&packaging=war&type=gradle.zip")
|
||||
.isJavaWarProject().isGradleProject();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void downloadCli() throws Exception {
|
||||
void downloadCli() throws Exception {
|
||||
assertSpringCliRedirect("/spring", "zip");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void downloadCliAsZip() throws Exception {
|
||||
void downloadCliAsZip() throws Exception {
|
||||
assertSpringCliRedirect("/spring.zip", "zip");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void downloadCliAsTarGz() throws Exception {
|
||||
void downloadCliAsTarGz() throws Exception {
|
||||
assertSpringCliRedirect("/spring.tar.gz", "tar.gz");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void downloadCliAsTgz() throws Exception {
|
||||
void downloadCliAsTgz() throws Exception {
|
||||
assertSpringCliRedirect("/spring.tgz", "tar.gz");
|
||||
}
|
||||
|
||||
@ -153,7 +153,7 @@ public class MainControllerIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void metadataWithNoAcceptHeader() {
|
||||
void metadataWithNoAcceptHeader() {
|
||||
// rest template sets application/json by default
|
||||
ResponseEntity<String> response = invokeHome(null, "*/*");
|
||||
validateCurrentMetadata(response);
|
||||
@ -169,7 +169,7 @@ public class MainControllerIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void metadataWithV2AcceptHeader() {
|
||||
void metadataWithV2AcceptHeader() {
|
||||
ResponseEntity<String> response = invokeHome(null,
|
||||
"application/vnd.initializr.v2+json");
|
||||
validateMetadata(response, InitializrMetadataVersion.V2.getMediaType(), "2.0.0",
|
||||
@ -177,7 +177,7 @@ public class MainControllerIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void metadataWithCurrentAcceptHeader() {
|
||||
void metadataWithCurrentAcceptHeader() {
|
||||
getRequests().setFields("_links.maven-project", "dependencies.values[0]",
|
||||
"type.values[0]", "javaVersion.values[0]", "packaging.values[0]",
|
||||
"bootVersion.values[0]", "language.values[0]");
|
||||
@ -190,7 +190,7 @@ public class MainControllerIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void metadataWithSeveralAcceptHeader() {
|
||||
void metadataWithSeveralAcceptHeader() {
|
||||
ResponseEntity<String> response = invokeHome(null,
|
||||
"application/vnd.initializr.v2.1+json",
|
||||
"application/vnd.initializr.v2+json");
|
||||
@ -200,7 +200,7 @@ public class MainControllerIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void metadataWithHalAcceptHeader() {
|
||||
void metadataWithHalAcceptHeader() {
|
||||
ResponseEntity<String> response = invokeHome(null, "application/hal+json");
|
||||
assertThat(response.getHeaders().getFirst(HttpHeaders.ETAG)).isNotNull();
|
||||
validateContentType(response, MainController.HAL_JSON_CONTENT_TYPE);
|
||||
@ -208,7 +208,7 @@ public class MainControllerIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void metadataWithUnknownAcceptHeader() {
|
||||
void metadataWithUnknownAcceptHeader() {
|
||||
try {
|
||||
invokeHome(null, "application/vnd.initializr.v5.4+json");
|
||||
}
|
||||
@ -218,20 +218,20 @@ public class MainControllerIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void curlReceivesTextByDefault() {
|
||||
void curlReceivesTextByDefault() {
|
||||
ResponseEntity<String> response = invokeHome("curl/1.2.4", "*/*");
|
||||
validateCurlHelpContent(response);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void curlCanStillDownloadZipArchive() {
|
||||
void curlCanStillDownloadZipArchive() {
|
||||
ResponseEntity<byte[]> response = execute("/starter.zip", byte[].class,
|
||||
"curl/1.2.4", "*/*");
|
||||
zipProjectAssert(response.getBody()).isMavenProject().isJavaProject();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void curlCanStillDownloadTgzArchive() {
|
||||
void curlCanStillDownloadTgzArchive() {
|
||||
ResponseEntity<byte[]> response = execute("/starter.tgz", byte[].class,
|
||||
"curl/1.2.4", "*/*");
|
||||
tgzProjectAssert(response.getBody()).isMavenProject().isJavaProject();
|
||||
@ -247,19 +247,19 @@ public class MainControllerIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void curlWithAcceptHeaderTextPlain() {
|
||||
void curlWithAcceptHeaderTextPlain() {
|
||||
ResponseEntity<String> response = invokeHome("curl/1.2.4", "text/plain");
|
||||
validateCurlHelpContent(response);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void unknownAgentReceivesJsonByDefault() {
|
||||
void unknownAgentReceivesJsonByDefault() {
|
||||
ResponseEntity<String> response = invokeHome("foo/1.0", "*/*");
|
||||
validateCurrentMetadata(response);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void httpieReceivesTextByDefault() {
|
||||
void httpieReceivesTextByDefault() {
|
||||
ResponseEntity<String> response = invokeHome("HTTPie/0.8.0", "*/*");
|
||||
validateHttpIeHelpContent(response);
|
||||
}
|
||||
@ -274,19 +274,19 @@ public class MainControllerIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void httpieWithAcceptHeaderTextPlain() {
|
||||
void httpieWithAcceptHeaderTextPlain() {
|
||||
ResponseEntity<String> response = invokeHome("HTTPie/0.8.0", "text/plain");
|
||||
validateHttpIeHelpContent(response);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void unknownCliWithTextPlain() {
|
||||
void unknownCliWithTextPlain() {
|
||||
ResponseEntity<String> response = invokeHome(null, "text/plain");
|
||||
validateGenericHelpContent(response);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void springBootCliReceivesJsonByDefault() {
|
||||
void springBootCliReceivesJsonByDefault() {
|
||||
ResponseEntity<String> response = invokeHome("SpringBootCli/1.2.0", "*/*");
|
||||
validateContentType(response,
|
||||
AbstractInitializrIntegrationTests.CURRENT_METADATA_MEDIA_TYPE);
|
||||
@ -294,7 +294,7 @@ public class MainControllerIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void springBootCliWithAcceptHeaderText() {
|
||||
void springBootCliWithAcceptHeaderText() {
|
||||
ResponseEntity<String> response = invokeHome("SpringBootCli/1.2.0", "text/plain");
|
||||
validateSpringBootHelpContent(response);
|
||||
}
|
||||
@ -306,7 +306,7 @@ public class MainControllerIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void doNotForceSslByDefault() {
|
||||
void doNotForceSslByDefault() {
|
||||
ResponseEntity<String> response = invokeHome("curl/1.2.4", "*/*");
|
||||
String body = response.getBody();
|
||||
assertThat(body).as("Must not force https").contains("http://start.spring.io/");
|
||||
@ -342,7 +342,7 @@ public class MainControllerIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void missingDependencyProperException() {
|
||||
void missingDependencyProperException() {
|
||||
try {
|
||||
downloadArchive("/starter.zip?style=foo:bar");
|
||||
fail("Should have failed");
|
||||
@ -355,7 +355,7 @@ public class MainControllerIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void invalidDependencyProperException() {
|
||||
void invalidDependencyProperException() {
|
||||
try {
|
||||
downloadArchive("/starter.zip?style=foo");
|
||||
fail("Should have failed");
|
||||
@ -368,13 +368,13 @@ public class MainControllerIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void homeIsJson() {
|
||||
void homeIsJson() {
|
||||
String body = invokeHome(null, (String[]) null).getBody();
|
||||
assertThat(body).contains("\"dependencies\"");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void webIsAddedPom() {
|
||||
void webIsAddedPom() {
|
||||
String body = getRestTemplate().getForObject(createUrl("/pom.xml?packaging=war"),
|
||||
String.class);
|
||||
assertThat(body).contains("spring-boot-starter-web");
|
||||
@ -382,7 +382,7 @@ public class MainControllerIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void webIsAddedGradle() {
|
||||
void webIsAddedGradle() {
|
||||
String body = getRestTemplate()
|
||||
.getForObject(createUrl("/build.gradle?packaging=war"), String.class);
|
||||
assertThat(body).contains("spring-boot-starter-web");
|
||||
@ -390,27 +390,27 @@ public class MainControllerIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void homeHasWebStyle() {
|
||||
void homeHasWebStyle() {
|
||||
String body = htmlHome();
|
||||
assertThat(body).contains("name=\"style\" value=\"web\"");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void homeHasBootVersion() {
|
||||
void homeHasBootVersion() {
|
||||
String body = htmlHome();
|
||||
assertThat(body).contains("name=\"bootVersion\"");
|
||||
assertThat(body).contains("2.2.0.BUILD-SNAPSHOT\"");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void homeHasOnlyProjectFormatTypes() {
|
||||
void homeHasOnlyProjectFormatTypes() {
|
||||
String body = htmlHome();
|
||||
assertThat(body).contains("Maven Project");
|
||||
assertThat(body).doesNotContain("Maven POM");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void downloadStarter() {
|
||||
void downloadStarter() {
|
||||
byte[] body = getRestTemplate().getForObject(createUrl("starter.zip"),
|
||||
byte[].class);
|
||||
assertThat(body).isNotNull();
|
||||
@ -418,7 +418,7 @@ public class MainControllerIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void installer() {
|
||||
void installer() {
|
||||
ResponseEntity<String> response = getRestTemplate()
|
||||
.getForEntity(createUrl("install.sh"), String.class);
|
||||
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
|
||||
@ -426,7 +426,7 @@ public class MainControllerIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void googleAnalyticsDisabledByDefault() {
|
||||
void googleAnalyticsDisabledByDefault() {
|
||||
String body = htmlHome();
|
||||
assertThat(body).doesNotContain("GoogleAnalyticsObject");
|
||||
}
|
||||
|
@ -40,14 +40,14 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
@ActiveProfiles("test-default")
|
||||
public class MainControllerServiceMetadataIntegrationTests
|
||||
class MainControllerServiceMetadataIntegrationTests
|
||||
extends AbstractFullStackInitializrIntegrationTests {
|
||||
|
||||
@Autowired
|
||||
private InitializrMetadataProvider metadataProvider;
|
||||
|
||||
@Test
|
||||
public void initializeRemoteConfig() throws Exception {
|
||||
void initializeRemoteConfig() throws Exception {
|
||||
InitializrMetadata localMetadata = this.metadataProvider.get();
|
||||
InitializrMetadata metadata = InitializrMetadataBuilder.create()
|
||||
.withInitializrMetadata(new UrlResource(createUrl("/metadata/config")))
|
||||
@ -68,7 +68,7 @@ public class MainControllerServiceMetadataIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void textPlainNotAccepted() {
|
||||
void textPlainNotAccepted() {
|
||||
try {
|
||||
execute("/metadata/config", String.class, null, "text/plain");
|
||||
}
|
||||
@ -78,7 +78,7 @@ public class MainControllerServiceMetadataIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validateJson() throws JSONException {
|
||||
void validateJson() throws JSONException {
|
||||
ResponseEntity<String> response = execute("/metadata/config", String.class, null,
|
||||
"application/json");
|
||||
validateContentType(response, MediaType.APPLICATION_JSON);
|
||||
@ -88,7 +88,7 @@ public class MainControllerServiceMetadataIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void metadataClientRedirect() {
|
||||
void metadataClientRedirect() {
|
||||
ResponseEntity<String> response = execute("/metadata/client", String.class, null,
|
||||
"application/json");
|
||||
validateCurrentMetadata(response);
|
||||
|
@ -36,11 +36,11 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
@ActiveProfiles({ "test-default", "test-ssl" })
|
||||
public class MainControllerSslIntegrationTests
|
||||
class MainControllerSslIntegrationTests
|
||||
extends AbstractInitializrControllerIntegrationTests {
|
||||
|
||||
@Test
|
||||
public void mainPageRedirectsToHttps() {
|
||||
void mainPageRedirectsToHttps() {
|
||||
ResponseEntity<Void> request = execute("/", Void.class, null,
|
||||
MediaType.TEXT_HTML_VALUE);
|
||||
assertThat(request.getStatusCode()).isEqualTo(HttpStatus.FOUND);
|
||||
@ -50,7 +50,7 @@ public class MainControllerSslIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void forceSsl() {
|
||||
void forceSsl() {
|
||||
ResponseEntity<String> response = invokeHome("curl/1.2.4", "*/*");
|
||||
String body = response.getBody();
|
||||
assertThat(body).as("Must force https").contains("https://start.spring.io/");
|
||||
@ -58,7 +58,7 @@ public class MainControllerSslIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void forceSslInMetadata() {
|
||||
void forceSslInMetadata() {
|
||||
ResponseEntity<String> response = invokeHome(null,
|
||||
"application/vnd.initializr.v2.1+json");
|
||||
validateMetadata(response, InitializrMetadataVersion.V2_1.getMediaType(),
|
||||
@ -66,7 +66,7 @@ public class MainControllerSslIntegrationTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void forceSslInMetadataV2() {
|
||||
void forceSslInMetadataV2() {
|
||||
ResponseEntity<String> response = invokeHome(null,
|
||||
"application/vnd.initializr.v2+json");
|
||||
validateMetadata(response, InitializrMetadataVersion.V2.getMediaType(),
|
||||
|
@ -31,11 +31,11 @@ import org.springframework.test.context.ActiveProfiles;
|
||||
|
||||
@ActiveProfiles("test-default")
|
||||
@Import(ProjectRequestPostProcessorConfiguration.class)
|
||||
public class ProjectGenerationPostProcessorTests
|
||||
class ProjectGenerationPostProcessorTests
|
||||
extends AbstractInitializrControllerIntegrationTests {
|
||||
|
||||
@Test
|
||||
public void postProcessorsInvoked() {
|
||||
void postProcessorsInvoked() {
|
||||
downloadZip("/starter.zip?bootVersion=2.0.4.RELEASE&javaVersion=1.8")
|
||||
.isJavaProject().isMavenProject().pomAssert()
|
||||
.hasSpringBootParent("2.2.3.RELEASE").hasProperty("java.version", "1.7");
|
||||
|
@ -49,8 +49,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*/
|
||||
@ExtendWith(TempDirectory.class)
|
||||
@ActiveProfiles("test-default")
|
||||
public class ProjectGenerationSmokeTests
|
||||
extends AbstractFullStackInitializrIntegrationTests {
|
||||
class ProjectGenerationSmokeTests extends AbstractFullStackInitializrIntegrationTests {
|
||||
|
||||
private File downloadDir;
|
||||
|
||||
@ -86,7 +85,7 @@ public class ProjectGenerationSmokeTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createSimpleProject() throws Exception {
|
||||
void createSimpleProject() throws Exception {
|
||||
HomePage page = toHome();
|
||||
page.submit();
|
||||
assertSimpleProject().isMavenProject().pomAssert().hasDependenciesCount(2)
|
||||
@ -94,7 +93,7 @@ public class ProjectGenerationSmokeTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createSimpleProjectWithGradle() throws Exception {
|
||||
void createSimpleProjectWithGradle() throws Exception {
|
||||
HomePage page = toHome();
|
||||
page.type("gradle-project");
|
||||
page.submit();
|
||||
@ -105,7 +104,7 @@ public class ProjectGenerationSmokeTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createSimpleProjectWithDifferentBootVersion() throws Exception {
|
||||
void createSimpleProjectWithDifferentBootVersion() throws Exception {
|
||||
HomePage page = toHome();
|
||||
page.bootVersion("1.5.17.RELEASE");
|
||||
page.submit();
|
||||
@ -116,7 +115,7 @@ public class ProjectGenerationSmokeTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createSimpleProjectWithDependencies() throws Exception {
|
||||
void createSimpleProjectWithDependencies() throws Exception {
|
||||
HomePage page = toHome();
|
||||
selectDependency(page, "Data JPA");
|
||||
selectDependency(page, "Security");
|
||||
@ -127,7 +126,7 @@ public class ProjectGenerationSmokeTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void selectDependencyTwiceRemovesIt() throws Exception {
|
||||
void selectDependencyTwiceRemovesIt() throws Exception {
|
||||
HomePage page = toHome();
|
||||
selectDependency(page, "Data JPA");
|
||||
selectDependency(page, "Security");
|
||||
@ -138,8 +137,7 @@ public class ProjectGenerationSmokeTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void selectDependencyAndChangeToIncompatibleVersionRemovesIt()
|
||||
throws Exception {
|
||||
void selectDependencyAndChangeToIncompatibleVersionRemovesIt() throws Exception {
|
||||
HomePage page = toHome();
|
||||
selectDependency(page, "Data JPA");
|
||||
selectDependency(page, "org.acme:bur");
|
||||
@ -151,7 +149,7 @@ public class ProjectGenerationSmokeTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void customArtifactIdUpdateNameAutomatically() throws Exception {
|
||||
void customArtifactIdUpdateNameAutomatically() throws Exception {
|
||||
HomePage page = toHome();
|
||||
page.groupId("org.foo");
|
||||
page.submit();
|
||||
@ -160,7 +158,7 @@ public class ProjectGenerationSmokeTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void customGroupIdIdUpdatePackageAutomatically() throws Exception {
|
||||
void customGroupIdIdUpdatePackageAutomatically() throws Exception {
|
||||
HomePage page = toHome();
|
||||
page.artifactId("my-project");
|
||||
page.submit();
|
||||
@ -169,7 +167,7 @@ public class ProjectGenerationSmokeTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void customArtifactIdWithInvalidPackageNameIsHandled() throws Exception {
|
||||
void customArtifactIdWithInvalidPackageNameIsHandled() throws Exception {
|
||||
HomePage page = toHome();
|
||||
page.artifactId("42my-project");
|
||||
page.submit();
|
||||
@ -178,7 +176,7 @@ public class ProjectGenerationSmokeTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createGroovyProject() throws Exception {
|
||||
void createGroovyProject() throws Exception {
|
||||
HomePage page = toHome();
|
||||
page.language("groovy");
|
||||
page.submit();
|
||||
@ -190,7 +188,7 @@ public class ProjectGenerationSmokeTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createKotlinProject() throws Exception {
|
||||
void createKotlinProject() throws Exception {
|
||||
HomePage page = toHome();
|
||||
page.language("kotlin");
|
||||
page.submit();
|
||||
@ -203,7 +201,7 @@ public class ProjectGenerationSmokeTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createWarProject() throws Exception {
|
||||
void createWarProject() throws Exception {
|
||||
HomePage page = toHome();
|
||||
page.advanced();
|
||||
page.packaging("war");
|
||||
@ -216,7 +214,7 @@ public class ProjectGenerationSmokeTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createJavaProjectWithCustomDefaults() throws Exception {
|
||||
void createJavaProjectWithCustomDefaults() throws Exception {
|
||||
HomePage page = toHome();
|
||||
page.groupId("com.acme");
|
||||
page.artifactId("foo-bar");
|
||||
@ -238,7 +236,7 @@ public class ProjectGenerationSmokeTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createKotlinProjectWithCustomDefaults() throws Exception {
|
||||
void createKotlinProjectWithCustomDefaults() throws Exception {
|
||||
HomePage page = toHome();
|
||||
page.groupId("com.acme");
|
||||
page.artifactId("foo-bar");
|
||||
@ -261,7 +259,7 @@ public class ProjectGenerationSmokeTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createGroovyProjectWithCustomDefaults() throws Exception {
|
||||
void createGroovyProjectWithCustomDefaults() throws Exception {
|
||||
HomePage page = toHome();
|
||||
page.groupId("com.acme");
|
||||
page.artifactId("foo-bar");
|
||||
@ -284,7 +282,7 @@ public class ProjectGenerationSmokeTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void dependencyHiddenAccordingToRange() throws Exception {
|
||||
void dependencyHiddenAccordingToRange() throws Exception {
|
||||
HomePage page = toHome(); // bur: [2.1.4.RELEASE,2.2.0.BUILD-SNAPSHOT)
|
||||
page.advanced();
|
||||
assertThat(page.dependency("org.acme:bur").isEnabled()).isTrue();
|
||||
@ -300,7 +298,7 @@ public class ProjectGenerationSmokeTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void dependencyUncheckedWhenHidden() throws Exception {
|
||||
void dependencyUncheckedWhenHidden() throws Exception {
|
||||
HomePage page = toHome(); // bur: [2.1.4.RELEASE,2.2.0.BUILD-SNAPSHOT)
|
||||
page.advanced();
|
||||
page.dependency("org.acme:bur").click();
|
||||
@ -313,7 +311,7 @@ public class ProjectGenerationSmokeTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void customizationShowsUpInDefaultView() throws Exception {
|
||||
void customizationShowsUpInDefaultView() throws Exception {
|
||||
HomePage page = toHome("/#!language=groovy&packageName=com.example.acme");
|
||||
assertThat(page.value("language")).isEqualTo("groovy");
|
||||
assertThat(page.value("packageName")).isEqualTo("com.example.acme");
|
||||
@ -328,7 +326,7 @@ public class ProjectGenerationSmokeTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void customizationsShowsUpWhenViewIsSwitched() throws Exception {
|
||||
void customizationsShowsUpWhenViewIsSwitched() throws Exception {
|
||||
HomePage page = toHome("/#!packaging=war&javaVersion=1.7");
|
||||
assertThat(page.value("packaging")).isEqualTo("war");
|
||||
assertThat(page.value("javaVersion")).isEqualTo("1.7");
|
||||
@ -341,7 +339,7 @@ public class ProjectGenerationSmokeTests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void customizationsOnGroupIdAndArtifactId() throws Exception {
|
||||
void customizationsOnGroupIdAndArtifactId() throws Exception {
|
||||
HomePage page = toHome("/#!groupId=com.example.acme&artifactId=my-project");
|
||||
page.submit();
|
||||
ProjectAssert projectAssert = zipProjectAssert(from("my-project.zip"));
|
||||
|
@ -30,12 +30,12 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
/**
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class DefaultDependencyMetadataProviderTests {
|
||||
class DefaultDependencyMetadataProviderTests {
|
||||
|
||||
private final DependencyMetadataProvider provider = new DefaultDependencyMetadataProvider();
|
||||
|
||||
@Test
|
||||
public void filterDependencies() {
|
||||
void filterDependencies() {
|
||||
Dependency first = Dependency.withId("first", "org.foo", "first");
|
||||
first.setVersionRange("2.1.4.RELEASE");
|
||||
Dependency second = Dependency.withId("second", "org.foo", "second");
|
||||
@ -53,7 +53,7 @@ public class DefaultDependencyMetadataProviderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveDependencies() {
|
||||
void resolveDependencies() {
|
||||
Dependency first = Dependency.withId("first", "org.foo", "first");
|
||||
first.getMappings().add(Dependency.Mapping.create(
|
||||
"[1.0.0.RELEASE, 1.1.0.RELEASE)", "org.bar", "second", "0.1.0.RELEASE"));
|
||||
@ -86,7 +86,7 @@ public class DefaultDependencyMetadataProviderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addRepoAndRemoveDuplicates() {
|
||||
void addRepoAndRemoveDuplicates() {
|
||||
Dependency first = Dependency.withId("first", "org.foo", "first");
|
||||
first.setRepository("repo-foo");
|
||||
Dependency second = Dependency.withId("second", "org.foo", "second");
|
||||
@ -105,7 +105,7 @@ public class DefaultDependencyMetadataProviderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addBomAndRemoveDuplicates() {
|
||||
void addBomAndRemoveDuplicates() {
|
||||
Dependency first = Dependency.withId("first", "org.foo", "first");
|
||||
first.setBom("bom-foo");
|
||||
Dependency second = Dependency.withId("second", "org.foo", "second");
|
||||
@ -134,7 +134,7 @@ public class DefaultDependencyMetadataProviderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void repoFromBomAccordingToVersion() {
|
||||
void repoFromBomAccordingToVersion() {
|
||||
DependencyMetadata dependencyMetadata = testRepoFromBomAccordingToVersion(
|
||||
"1.0.9.RELEASE");
|
||||
assertThat(dependencyMetadata.getBootVersion())
|
||||
@ -155,7 +155,7 @@ public class DefaultDependencyMetadataProviderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void repoFromBomAccordingToAnotherVersion() {
|
||||
void repoFromBomAccordingToAnotherVersion() {
|
||||
DependencyMetadata dependencyMetadata = testRepoFromBomAccordingToVersion(
|
||||
"1.1.5.RELEASE");
|
||||
assertThat(dependencyMetadata.getBootVersion())
|
||||
|
@ -41,7 +41,7 @@ import static org.springframework.test.web.client.response.MockRestResponseCreat
|
||||
/**
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class DefaultInitializrMetadataProviderTests {
|
||||
class DefaultInitializrMetadataProviderTests {
|
||||
|
||||
private static final ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
@ -56,7 +56,7 @@ public class DefaultInitializrMetadataProviderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bootVersionsAreReplaced() {
|
||||
void bootVersionsAreReplaced() {
|
||||
InitializrMetadata metadata = new InitializrMetadataTestBuilder()
|
||||
.addBootVersion("0.0.9.RELEASE", true)
|
||||
.addBootVersion("0.0.8.RELEASE", false).build();
|
||||
@ -79,7 +79,7 @@ public class DefaultInitializrMetadataProviderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void defaultBootVersionIsAlwaysSet() {
|
||||
void defaultBootVersionIsAlwaysSet() {
|
||||
InitializrMetadata metadata = new InitializrMetadataTestBuilder()
|
||||
.addBootVersion("0.0.9.RELEASE", true)
|
||||
.addBootVersion("0.0.8.RELEASE", false).build();
|
||||
|
@ -40,7 +40,7 @@ import static org.springframework.test.web.client.response.MockRestResponseCreat
|
||||
* @author Stephane Nicoll
|
||||
* @author Dave Syer
|
||||
*/
|
||||
public class SpringBootMetadataReaderTests {
|
||||
class SpringBootMetadataReaderTests {
|
||||
|
||||
private final InitializrMetadata metadata = InitializrMetadataBuilder.create()
|
||||
.build();
|
||||
@ -53,7 +53,7 @@ public class SpringBootMetadataReaderTests {
|
||||
.bindTo(this.restTemplate).build();
|
||||
|
||||
@Test
|
||||
public void readAvailableVersions() throws IOException {
|
||||
void readAvailableVersions() throws IOException {
|
||||
this.server.expect(requestTo("https://spring.io/project_metadata/spring-boot"))
|
||||
.andRespond(withSuccess(
|
||||
new ClassPathResource("metadata/sagan/spring-boot.json"),
|
||||
|
@ -31,18 +31,17 @@ import org.springframework.test.context.ActiveProfiles;
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
@ActiveProfiles("test-default")
|
||||
public class UiControllerIntegrationTests
|
||||
extends AbstractInitializrControllerIntegrationTests {
|
||||
class UiControllerIntegrationTests extends AbstractInitializrControllerIntegrationTests {
|
||||
|
||||
@Test
|
||||
public void dependenciesNoVersion() throws JSONException {
|
||||
void dependenciesNoVersion() throws JSONException {
|
||||
ResponseEntity<String> response = execute("/ui/dependencies", String.class, null);
|
||||
validateContentType(response, MediaType.APPLICATION_JSON);
|
||||
validateDependenciesOutput("all", response.getBody());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void dependenciesSpecificVersion() throws JSONException {
|
||||
void dependenciesSpecificVersion() throws JSONException {
|
||||
ResponseEntity<String> response = execute(
|
||||
"/ui/dependencies?version=1.1.2.RELEASE", String.class, null);
|
||||
validateContentType(response, MediaType.APPLICATION_JSON);
|
||||
|
Loading…
Reference in New Issue
Block a user