diff --git a/start-site/src/test/java/io/spring/start/site/extension/dependency/testcontainers/TestcontainersProjectGenerationConfigurationTests.java b/start-site/src/test/java/io/spring/start/site/extension/dependency/testcontainers/TestcontainersProjectGenerationConfigurationTests.java index d06ad5ea0fb..fbd512cac25 100644 --- a/start-site/src/test/java/io/spring/start/site/extension/dependency/testcontainers/TestcontainersProjectGenerationConfigurationTests.java +++ b/start-site/src/test/java/io/spring/start/site/extension/dependency/testcontainers/TestcontainersProjectGenerationConfigurationTests.java @@ -38,6 +38,7 @@ * @author EddĂș MelĂ©ndez * @author Chris Bono * @author Moritz Halbritter + * @author Ngoc Nhan */ class TestcontainersProjectGenerationConfigurationTests extends AbstractExtensionTests { @@ -191,7 +192,7 @@ void testApplicationWithGroovyAndGenericContainerIsContributed() { request.setLanguage("groovy"); assertThat(generateProject(request)) .textFile("src/test/groovy/com/example/demo/TestcontainersConfiguration.groovy") - .isEqualTo(""" + .isEqualToNormalizingNewlines(""" package com.example.demo import org.springframework.boot.test.context.TestConfiguration @@ -219,7 +220,7 @@ void testApplicationWithJavaAndGenericContainerIsContributed() { request.setBootVersion(SPRING_BOOT_VERSION_3_3); request.setLanguage("java"); assertThat(generateProject(request)).textFile("src/test/java/com/example/demo/TestcontainersConfiguration.java") - .isEqualTo(""" + .isEqualToNormalizingNewlines(""" package com.example.demo; import org.springframework.boot.test.context.TestConfiguration; @@ -247,7 +248,7 @@ void testApplicationWithKotlinAndGenericContainerIsContributed() { request.setBootVersion(SPRING_BOOT_VERSION_3_3); request.setLanguage("kotlin"); assertThat(generateProject(request)).textFile("src/test/kotlin/com/example/demo/TestcontainersConfiguration.kt") - .isEqualTo(""" + .isEqualToNormalizingNewlines(""" package com.example.demo import org.springframework.boot.test.context.TestConfiguration @@ -276,7 +277,7 @@ void testApplicationWithGroovyAndSpecificContainerIsContributed() { request.setLanguage("groovy"); ProjectStructure projectStructure = generateProject(request); assertThat(projectStructure).textFile("src/test/groovy/com/example/demo/TestDemoApplication.groovy") - .isEqualTo(""" + .isEqualToNormalizingNewlines(""" package com.example.demo import org.springframework.boot.SpringApplication @@ -290,7 +291,7 @@ static void main(String[] args) { } """); assertThat(projectStructure).textFile("src/test/groovy/com/example/demo/TestcontainersConfiguration.groovy") - .isEqualTo(""" + .isEqualToNormalizingNewlines(""" package com.example.demo import org.springframework.boot.test.context.TestConfiguration @@ -311,7 +312,7 @@ CassandraContainer cassandraContainer() { } """); assertThat(projectStructure).textFile("src/test/groovy/com/example/demo/DemoApplicationTests.groovy") - .isEqualTo(""" + .isEqualToNormalizingNewlines(""" package com.example.demo import org.junit.jupiter.api.Test @@ -336,21 +337,23 @@ void testApplicationWithJavaAndSpecificContainerIsContributed() { request.setBootVersion(SPRING_BOOT_VERSION_3_3); request.setLanguage("java"); ProjectStructure projectStructure = generateProject(request); - assertThat(projectStructure).textFile("src/test/java/com/example/demo/TestDemoApplication.java").isEqualTo(""" - package com.example.demo; + assertThat(projectStructure).textFile("src/test/java/com/example/demo/TestDemoApplication.java") + .isEqualToNormalizingNewlines( + """ + package com.example.demo; - import org.springframework.boot.SpringApplication; + import org.springframework.boot.SpringApplication; - public class TestDemoApplication { + public class TestDemoApplication { - public static void main(String[] args) { - SpringApplication.from(DemoApplication::main).with(TestcontainersConfiguration.class).run(args); - } + public static void main(String[] args) { + SpringApplication.from(DemoApplication::main).with(TestcontainersConfiguration.class).run(args); + } - } - """); + } + """); assertThat(projectStructure).textFile("src/test/java/com/example/demo/TestcontainersConfiguration.java") - .isEqualTo(""" + .isEqualToNormalizingNewlines(""" package com.example.demo; import org.springframework.boot.test.context.TestConfiguration; @@ -370,23 +373,24 @@ CassandraContainer cassandraContainer() { } """); - assertThat(projectStructure).textFile("src/test/java/com/example/demo/DemoApplicationTests.java").isEqualTo(""" - package com.example.demo; + assertThat(projectStructure).textFile("src/test/java/com/example/demo/DemoApplicationTests.java") + .isEqualToNormalizingNewlines(""" + package com.example.demo; - import org.junit.jupiter.api.Test; - import org.springframework.boot.test.context.SpringBootTest; - import org.springframework.context.annotation.Import; + import org.junit.jupiter.api.Test; + import org.springframework.boot.test.context.SpringBootTest; + import org.springframework.context.annotation.Import; - @Import(TestcontainersConfiguration.class) - @SpringBootTest - class DemoApplicationTests { + @Import(TestcontainersConfiguration.class) + @SpringBootTest + class DemoApplicationTests { - @Test - void contextLoads() { - } + @Test + void contextLoads() { + } - } - """); + } + """); } @Test @@ -395,19 +399,20 @@ void testApplicationWithKotlinAndSpecificContainerIsContributed() { request.setBootVersion(SPRING_BOOT_VERSION_3_3); request.setLanguage("kotlin"); ProjectStructure projectStructure = generateProject(request); - assertThat(projectStructure).textFile("src/test/kotlin/com/example/demo/TestDemoApplication.kt").isEqualTo(""" - package com.example.demo + assertThat(projectStructure).textFile("src/test/kotlin/com/example/demo/TestDemoApplication.kt") + .isEqualToNormalizingNewlines(""" + package com.example.demo - import org.springframework.boot.fromApplication - import org.springframework.boot.with + import org.springframework.boot.fromApplication + import org.springframework.boot.with - fun main(args: Array) { - fromApplication().with(TestcontainersConfiguration::class).run(*args) - } - """); + fun main(args: Array) { + fromApplication().with(TestcontainersConfiguration::class).run(*args) + } + """); assertThat(projectStructure).textFile("src/test/kotlin/com/example/demo/TestcontainersConfiguration.kt") - .isEqualTo(""" + .isEqualToNormalizingNewlines(""" package com.example.demo import org.springframework.boot.test.context.TestConfiguration @@ -427,23 +432,24 @@ fun cassandraContainer(): CassandraContainer<*> { } """); - assertThat(projectStructure).textFile("src/test/kotlin/com/example/demo/DemoApplicationTests.kt").isEqualTo(""" - package com.example.demo + assertThat(projectStructure).textFile("src/test/kotlin/com/example/demo/DemoApplicationTests.kt") + .isEqualToNormalizingNewlines(""" + package com.example.demo + + import org.junit.jupiter.api.Test + import org.springframework.boot.test.context.SpringBootTest + import org.springframework.context.annotation.Import - import org.junit.jupiter.api.Test - import org.springframework.boot.test.context.SpringBootTest - import org.springframework.context.annotation.Import + @Import(TestcontainersConfiguration::class) + @SpringBootTest + class DemoApplicationTests { - @Import(TestcontainersConfiguration::class) - @SpringBootTest - class DemoApplicationTests { + @Test + fun contextLoads() { + } - @Test - fun contextLoads() { } - - } - """); + """); } @Test