Polish migration to JUnit5

See gh-802
This commit is contained in:
Stephane Nicoll
2019-01-28 14:33:54 +01:00
parent 8ec763e0ba
commit 2b6ab498cf
52 changed files with 526 additions and 530 deletions

View File

@@ -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");

View File

@@ -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");

View File

@@ -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"),

View File

@@ -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"),

View File

@@ -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");

View File

@@ -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,

View File

@@ -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");

View File

@@ -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

View File

@@ -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");

View File

@@ -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)");

View File

@@ -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()

View File

@@ -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);

View File

@@ -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");

View File

@@ -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()

View File

@@ -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);

View File

@@ -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");

View File

@@ -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");

View File

@@ -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");

View File

@@ -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();
}

View File

@@ -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"));
}

View File

@@ -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");

View File

@@ -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)");

View File

@@ -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"));
}