Skip to content
Snippets Groups Projects
Commit e448546f authored by LABOUREL Arnaud's avatar LABOUREL Arnaud
Browse files

Version bio-info 2022

parent efc164be
Branches
No related tags found
No related merge requests found
......@@ -22,12 +22,14 @@
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
.gradle/
.idea/
# Gradle
.idea/gradle.xml
.idea/workspaces.xml
.idea/**/gradle.xml
.idea/**/libraries
.idea/misc.xml
.idea/vcs.xml
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
......@@ -37,7 +39,7 @@
.idea/compiler.xml
.idea/jarRepositories.xml
.idea/modules.xml
.idea/*.iml
idea/*.iml
.idea/modules
*.iml
*.ipr
......
image: gradle:jdk17
image: openjdk:17-alpine
variables:
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
......@@ -8,11 +11,30 @@ cache:
- .gradle/wrapper
- .gradle/caches
stages:
- build
- test
build:
stage: build
script: ./gradlew --build-cache assemble
cache:
key: "$CI_COMMIT_REF_NAME"
policy: push
paths:
- build
- .gradle
java:
stage: test
script:
- gradle test
script: ./gradlew test
artifacts:
when: always
reports:
junit: build/test-results/test/**/TEST-*.xml
cache:
key: "$CI_COMMIT_REF_NAME"
policy: pull
paths:
- build
- .gradle
\ No newline at end of file
......@@ -4,6 +4,6 @@
Le but de ce TP est de créer des classes permettant de représenter des étudiants (classe `Student`), des notes (classe `Grade`), des résultats à une unité d'enseignement (classe `TeachingUnitResult`) et des promotions d'étudiants (classe `Cohort`).
## Membres du projet
## Membre du projet
- NOM, prénom, numéro de groupe
plugins {
id "application"
id "java"
}
apply plugin : "java"
group 'l2info'
group 'M2_DLAD'
version '1.0-SNAPSHOT'
repositories {
......@@ -11,18 +11,15 @@ repositories {
}
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2', "org.assertj:assertj-core:3.22.0"
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
testImplementation('org.junit.jupiter:junit-jupiter-api:5.9.0',
'org.assertj:assertj-core:3.23.1')
testRuntimeOnly('org.junit.jupiter:junit-jupiter-engine:5.9.0')
}
test {
useJUnitPlatform()
}
ext {
javaMainClass = "Main"
}
application {
mainClassName = javaMainClass
mainClassName = "Main"
}
\ No newline at end of file
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
......@@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
......@@ -80,13 +80,13 @@ do
esac
done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
......@@ -143,12 +143,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
......@@ -205,6 +209,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
......
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
class TestCohort {
class CohortTest {
private static final Cohort cohort = new Cohort("L2 informatique");
private static final Student davidGoodenough = new Student("David", "Goodenough");
private static final Student jeanMichelBruitage = new Student("Jean-Michel", "Bruitage");
......@@ -13,23 +14,27 @@ class TestCohort {
@BeforeAll
static void addStudentsToCohort(){
jeanMichelBruitage.addResult("Programmation 2", TestGrade.zero);
jeanMichelBruitage.addResult("Structures discrètes", TestGrade.twenty);
davidGoodenough.addResult("Programmation 2", TestGrade.ten);
davidGoodenough.addResult("Structures discrètes", TestGrade.ten);
jeanMichelBruitage.addResult("Programmation 2", GradeTest.zero);
jeanMichelBruitage.addResult("Structures discrètes", GradeTest.twenty);
davidGoodenough.addResult("Programmation 2", GradeTest.ten);
davidGoodenough.addResult("Structures discrètes", GradeTest.ten);
cohort.addStudent(davidGoodenough);
cohort.addStudent(jeanMichelBruitage);
}
@Disabled("Disabled until Cohort is coded")
@Test
void testGetStudentsIsEmpty_whenEmptyCohort(){
assertThat(l1Descartes.getStudents()).isEmpty();
}
@Disabled("Disabled until Cohort is coded")
@Test
void testGetStudents_whenCohortContainsStudents(){
assertThat(cohort.getStudents()).isEqualTo(List.of(davidGoodenough, jeanMichelBruitage));
}
@Disabled("Disabled until Cohort is coded")
@Test
void testPrintStudentsResults_whenCohortIsEmpty() {
StandardOutputSandbox standardOutputSandbox = new StandardOutputSandbox(l1Descartes::printStudentsResults);
......@@ -38,6 +43,7 @@ class TestCohort {
assertThat(standardOutputSandbox.getProducedOutput()).isEqualTo(expectedOutput);
}
@Disabled("Disabled until Cohort is coded")
@Test
void testPrintStudentsResults_whenCohortContainsStudents() {
StandardOutputSandbox standardOutputSandbox = new StandardOutputSandbox(cohort::printStudentsResults);
......
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import java.util.List;
......@@ -5,7 +6,7 @@ import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.within;
class TestGrade {
class GradeTest {
static Grade twenty = new Grade(20);
static Grade zero = new Grade(0);
static Grade ten = new Grade(10);
......@@ -13,6 +14,7 @@ class TestGrade {
private static final List<Grade> grades = List.of(zero, twenty, ten);
private static final List<Grade> gradesZero = List.of(zero, zero);
@Disabled("Disabled until Grade is coded")
@Test
void testHashCode(){
assertThat(twenty.hashCode()).isEqualTo(new Grade(20).hashCode())
......@@ -20,6 +22,7 @@ class TestGrade {
.isNotEqualTo(zero.hashCode());
}
@Disabled("Disabled until Grade is coded")
@Test
void testEquals(){
assertThat(twenty).isEqualTo(new Grade(20))
......@@ -30,12 +33,14 @@ class TestGrade {
.isNotEqualTo(20.0);
}
@Disabled("Disabled until Grade is coded")
@Test
void testGetValue() {
assertThat(twenty.getValue()).isCloseTo(20, within(EPSILON));
assertThat(zero.getValue()).isCloseTo(0, within(EPSILON));
}
@Disabled("Disabled until Grade is coded")
@Test
void testToString() {
assertThat(twenty.toString()).isEqualTo("20.0/20");
......@@ -43,6 +48,7 @@ class TestGrade {
}
@Disabled("Disabled until Grade is coded")
@Test
void testAverageGrade(){
assertThat(Grade.averageGrade(grades)).isEqualTo(ten);
......
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
class TestStudent {
class StudentTest {
private static final Student arnaudLabourel = new Student("Arnaud", "Labourel");
private static final Student jeanMichelBruitage = new Student("Jean-Michel", "Bruitage");
private static final Student davidGoodenough = new Student("David", "Goodenough");
@Disabled("Disabled until Student is coded")
@BeforeAll
static void addResultsToStudents(){
arnaudLabourel.addResult("Programmation 2", TestGrade.twenty);
arnaudLabourel.addResult("Structures discrètes", TestGrade.twenty);
davidGoodenough.addResult("Programmation 2", TestGrade.ten);
davidGoodenough.addResult("Structures discrètes", TestGrade.zero);
jeanMichelBruitage.addResult("Programmation 2", TestGrade.ten);
jeanMichelBruitage.addResult("Structures discrètes", TestGrade.twenty);
arnaudLabourel.addResult("Programmation 2", GradeTest.twenty);
arnaudLabourel.addResult("Structures discrètes", GradeTest.twenty);
davidGoodenough.addResult("Programmation 2", GradeTest.ten);
davidGoodenough.addResult("Structures discrètes", GradeTest.zero);
jeanMichelBruitage.addResult("Programmation 2", GradeTest.ten);
jeanMichelBruitage.addResult("Structures discrètes", GradeTest.twenty);
}
@Disabled("Disabled until Student is coded")
@Test
void testHashCode(){
assertThat(jeanMichelBruitage.hashCode()).isEqualTo(new Student("Jean-Michel", "Bruitage").hashCode())
.isNotEqualTo(davidGoodenough.hashCode());
}
@Disabled("Disabled until Student is coded")
@Test
void testEquals(){
assertThat(jeanMichelBruitage).isEqualTo(new Student("Jean-Michel", "Bruitage"))
......@@ -34,26 +38,30 @@ class TestStudent {
.isNotEqualTo("Jean-Michel Bruitage");
}
@Disabled("Disabled until Student is coded")
@Test
void testToString() {
assertThat(jeanMichelBruitage.toString()).isEqualTo("Jean-Michel Bruitage");
assertThat(davidGoodenough.toString()).isEqualTo("David Goodenough");
}
@Disabled("Disabled until Student is coded")
@Test
void testGetGrades() {
assertThat(arnaudLabourel.getGrades()).isEqualTo(List.of(TestGrade.twenty, TestGrade.twenty));
assertThat(davidGoodenough.getGrades()).isEqualTo(List.of(TestGrade.ten, TestGrade.zero));
assertThat(jeanMichelBruitage.getGrades()).isEqualTo(List.of(TestGrade.ten, TestGrade.twenty));
assertThat(arnaudLabourel.getGrades()).isEqualTo(List.of(GradeTest.twenty, GradeTest.twenty));
assertThat(davidGoodenough.getGrades()).isEqualTo(List.of(GradeTest.ten, GradeTest.zero));
assertThat(jeanMichelBruitage.getGrades()).isEqualTo(List.of(GradeTest.ten, GradeTest.twenty));
}
@Disabled("Disabled until Student is coded")
@Test
void testGetAverageGrade() {
assertThat(arnaudLabourel.averageGrade()).isEqualTo(TestGrade.twenty);
assertThat(arnaudLabourel.averageGrade()).isEqualTo(GradeTest.twenty);
assertThat(davidGoodenough.averageGrade()).isEqualTo(new Grade(5));
assertThat(jeanMichelBruitage.averageGrade()).isEqualTo(new Grade(15));
}
@Disabled("Disabled until Student is coded")
@Test
void testPrintResults() {
StandardOutputSandbox standardOutputSandbox = new StandardOutputSandbox(arnaudLabourel::printResults);
......
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
class TestTeachingUnitResult {
class TeachingUnitResultTest {
private static final TeachingUnitResult twentyAtProg =
new TeachingUnitResult("Programmation 2", TestGrade.twenty);
new TeachingUnitResult("Programmation 2", GradeTest.twenty);
private static final TeachingUnitResult zeroAtStructDiscrete =
new TeachingUnitResult("Structures discrètes", TestGrade.zero);
new TeachingUnitResult("Structures discrètes", GradeTest.zero);
@Disabled("Disabled until TeachingUnitResult is coded")
@Test
void testGetGrade() {
assertThat(twentyAtProg.getGrade()).isEqualTo(TestGrade.twenty);
assertThat(zeroAtStructDiscrete.getGrade()).isEqualTo(TestGrade.zero);
assertThat(twentyAtProg.getGrade()).isEqualTo(GradeTest.twenty);
assertThat(zeroAtStructDiscrete.getGrade()).isEqualTo(GradeTest.zero);
}
@Disabled("Disabled until TeachingUnitResult is coded")
@Test
void testToString() {
assertThat(twentyAtProg.toString()).isEqualTo("Programmation 2 : 20.0/20");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment