From dfcfeac1fd1dfe34c0ee848330320579d1e73988 Mon Sep 17 00:00:00 2001 From: mouloud Date: Sun, 16 Feb 2025 20:41:10 -0500 Subject: [PATCH 1/4] Commit class Employee --- pom.xml | 105 ++++++++++++++++++-------------- src/main/java/Employee.java | 13 ++++ src/test/java/EmployeeTest.java | 27 ++++++++ 3 files changed, 99 insertions(+), 46 deletions(-) create mode 100644 src/main/java/Employee.java create mode 100644 src/test/java/EmployeeTest.java diff --git a/pom.xml b/pom.xml index 8171c1a..503b1e7 100644 --- a/pom.xml +++ b/pom.xml @@ -18,57 +18,70 @@ + - junit - junit - 4.13 + org.junit.jupiter + junit-jupiter-api + 5.10.0 test + + org.junit.jupiter + junit-jupiter-engine + 5.10.0 + test + + + org.junit.platform + junit-platform-suite + 1.10.0 + test + + + + org.projectlombok + lombok + 1.18.36 + provided + + - - - - - maven-clean-plugin - 3.1.0 - - - - maven-resources-plugin - 3.0.2 - - - maven-compiler-plugin - 3.8.0 - - - maven-surefire-plugin - 2.22.2 - - - maven-jar-plugin - 3.0.2 - - - maven-install-plugin - 2.5.2 - - - maven-deploy-plugin - 2.8.2 - - - - maven-site-plugin - 3.7.1 - - - maven-project-info-reports-plugin - 3.0.0 - - - + + + org.apache.maven.plugins + maven-surefire-plugin + 3.1.2 + + + **/*Test.java + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.1.2 + + + + **/*Test.java + + + true + true + + + + + org.apache.maven.plugins + maven-surefire-report-plugin + 3.1.2 + + + + diff --git a/src/main/java/Employee.java b/src/main/java/Employee.java new file mode 100644 index 0000000..b54b96e --- /dev/null +++ b/src/main/java/Employee.java @@ -0,0 +1,13 @@ +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public class Employee { + + private String name; + private String sexe; + private String adress; + private int salary; + private int idEmployee; +} diff --git a/src/test/java/EmployeeTest.java b/src/test/java/EmployeeTest.java new file mode 100644 index 0000000..6bad4e9 --- /dev/null +++ b/src/test/java/EmployeeTest.java @@ -0,0 +1,27 @@ +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +class EmployeeTest { + + Employee testEmployee = new Employee("Steeve", "Male", "Canada", 5200, 123); + + @BeforeAll + public static void debutDesTests () { + System.out.println("D.but des tests"); + } + + @Test + void testClassEmployee (){ + + Assertions.assertEquals("Steeve", testEmployee.getName(), "Le nom est bien Steeve"); + } + + @AfterAll + public static void finDesTests (){ + System.out.println("Fin de l'exécution des tests"); + } +} \ No newline at end of file From 4e5ab556a64d73f817e16c1ca715349378e0740c Mon Sep 17 00:00:00 2001 From: mouloud Date: Sun, 16 Feb 2025 21:24:24 -0500 Subject: [PATCH 2/4] Commit YAML --- .github/workflows/main.yml | 29 +++++++++++++++++++++++++++++ pom.xml | 7 +++++++ 2 files changed, 36 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..277227a --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,29 @@ +name: Java CI with Maven + +on: + push: + branches: + - main # Cette action s'exécute sur la branche "main" chaque fois qu'un commit est effectué. + pull_request: + branches: + - main # Cette action s'exécute lors de la création d'une pull request pour la branche "main". + +jobs: + build: + runs-on: ubuntu-latest # Utilise la dernière version d'Ubuntu pour l'exécution du job. + + steps: + - name: Checkout repository + uses: actions/checkout@v2 # Cette action clone ton code dans l'environnement d'exécution. + + - name: Set up JDK 23 + uses: actions/setup-java@v2 # Installe Java JDK 11 + with: + java-version: '23' + distribution: 'adoptopenjdk' + + - name: Build with Maven + run: mvn clean install # Compile et teste ton projet Maven. + + - name: Run tests + run: mvn test # Lance les tests automatisés de ton projet. diff --git a/pom.xml b/pom.xml index 503b1e7..96835fe 100644 --- a/pom.xml +++ b/pom.xml @@ -44,6 +44,13 @@ 1.18.36 provided + + + org.assertj + assertj-core + 3.27.3 + test + From 59ee4ba9ee1542811acde79b952d2abfaf4f5be0 Mon Sep 17 00:00:00 2001 From: mouloud Date: Sun, 16 Feb 2025 21:29:01 -0500 Subject: [PATCH 3/4] workflow --- .github/workflows/main.yml | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 277227a..a7cf7cc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,29 +1,26 @@ name: Java CI with Maven on: - push: - branches: - - main # Cette action s'exécute sur la branche "main" chaque fois qu'un commit est effectué. pull_request: branches: - - main # Cette action s'exécute lors de la création d'une pull request pour la branche "main". + - main # Déclenche l'action sur une PR vers la branche `main` jobs: build: - runs-on: ubuntu-latest # Utilise la dernière version d'Ubuntu pour l'exécution du job. + runs-on: ubuntu-latest # Utilisation de la dernière version d'Ubuntu pour exécuter l'action steps: - name: Checkout repository - uses: actions/checkout@v2 # Cette action clone ton code dans l'environnement d'exécution. + uses: actions/checkout@v2 # Clone ton code dans l'environnement d'exécution - - name: Set up JDK 23 - uses: actions/setup-java@v2 # Installe Java JDK 11 + - name: Set up JDK 11 + uses: actions/setup-java@v2 # Installe JDK 11 with: - java-version: '23' + java-version: '11' distribution: 'adoptopenjdk' - name: Build with Maven - run: mvn clean install # Compile et teste ton projet Maven. + run: mvn clean install # Compile ton projet Maven - name: Run tests - run: mvn test # Lance les tests automatisés de ton projet. + run: mvn test # Lance les tests unitaires From 2b0780093ba18dbb4637162b6c311695b1f998f1 Mon Sep 17 00:00:00 2001 From: mouloud Date: Sun, 16 Feb 2025 21:56:42 -0500 Subject: [PATCH 4/4] workflow --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a7cf7cc..1d07550 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,7 +3,7 @@ name: Java CI with Maven on: pull_request: branches: - - main # Déclenche l'action sur une PR vers la branche `main` + - master # Déclenche l'action sur une PR vers la branche `main` jobs: build: