Merge pull request #15679 from shahulbasha/BAEL-7206

BAEL-7206
This commit is contained in:
Andrea Giulio Cerasoni 2024-01-19 20:29:35 +00:00 committed by GitHub
commit 699cd6e8cd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 94 additions and 0 deletions

View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.baeldung</groupId>
<artifactId>maven-modules</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>maven-build-lifecycle</artifactId>
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.surefire.version>3.1.2</maven.surefire.version>
<maven.failsafe.version>3.1.2</maven.failsafe.version>
<junit.jupiter.version>5.3.1</junit.jupiter.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<!-- Maven Surefire Plugin for unit tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.surefire.version}</version>
<configuration>
<!-- Include test classes with names matching the pattern -->
<includes>
<include>**/*Test.java</include>
</includes>
</configuration>
</plugin>
<!-- Maven Failsafe Plugin for integration tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${maven.failsafe.version}</version>
<executions>
<!-- Run integration tests during the integration-test phase -->
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,7 @@
package com.baeldung.mavenlifecycle;
public class CourseApp {
public String getCourse() {
return "Baeldung Spring Masterclass";
}
}

View File

@ -0,0 +1,15 @@
package com.baeldung.mavenlifecycle;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
class CourseAppIT {
@Test
void givenIntegrationTest_whenGetCourse_ThenCourseShouldBePresent() {
CourseApp courseApp = new CourseApp();
assertEquals("Baeldung Spring Masterclass", courseApp.getCourse());
}
}

View File

@ -0,0 +1,16 @@
package com.baeldung.mavenlifecycle;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
class CourseAppUnitTest {
@Test
void whenGetCourse_ThenCourseShouldBePresent() {
CourseApp courseApp = new CourseApp();
assertEquals("Baeldung Spring Masterclass", courseApp.getCourse());
}
}

View File

@ -21,6 +21,7 @@
<module>host-maven-repo-example</module> <module>host-maven-repo-example</module>
<module>jacoco-coverage-aggregation</module> <module>jacoco-coverage-aggregation</module>
<module>maven-archetype</module> <module>maven-archetype</module>
<module>maven-build-lifecycle</module>
<module>maven-build-optimization</module> <module>maven-build-optimization</module>
<module>maven-builder-plugin</module> <module>maven-builder-plugin</module>
<module>maven-classifier</module> <module>maven-classifier</module>