diff --git a/.gitignore b/.gitignore index 96ca049..d4601a2 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ out .classpath .project .settings +.vscode/settings.json # Compiled class file *.class diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 52a1bb5..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "java.configuration.updateBuildConfiguration": "automatic", - "plantuml.server": "https://www.plantuml.com/plantuml" -} diff --git a/build.gradle b/build.gradle index 70fef4e..195ac77 100644 --- a/build.gradle +++ b/build.gradle @@ -18,17 +18,13 @@ repositories { } dependencies { - // This dependency is exported to consumers, that is to say found on their compile classpath. - api 'org.apache.commons:commons-math3:3.6.1' - - // This dependency is used internally, and not exposed to consumers on their own compile classpath. - implementation 'com.google.guava:guava:28.0-jre' - - // Use JUnit Jupiter API for testing. - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.4.2' - - // Use JUnit Jupiter Engine for testing. - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.4.2' + api(platform("org.junit:junit-bom:5.7.0")) + api("org.junit.jupiter:junit-jupiter-api") { + because 'building extensions in "main" using JUnit Jupiter API' + } + testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine") { + because 'at least one engine is needed at test runtime' + } } test { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 5028f28..28ff446 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/com/tetras/Carre.java b/src/main/java/com/tetras/Carre.java new file mode 100644 index 0000000..58f8c52 --- /dev/null +++ b/src/main/java/com/tetras/Carre.java @@ -0,0 +1,7 @@ +package com.tetras; + +public class Carre { + public void dessiner() { + System.out.println("Carré dessiné"); + } +} \ No newline at end of file diff --git a/src/main/java/com/tetras/Dessin.java b/src/main/java/com/tetras/Dessin.java new file mode 100644 index 0000000..fa63415 --- /dev/null +++ b/src/main/java/com/tetras/Dessin.java @@ -0,0 +1,13 @@ +package com.tetras; + +public class Dessin { + public void dessiner() { + System.out.println("Dessin dessiné"); + } + + public void ajouter(Carre carre) { + } + + public void ajouter(Rond rond) { + } +} \ No newline at end of file diff --git a/src/main/java/com/tetras/Rond.java b/src/main/java/com/tetras/Rond.java new file mode 100644 index 0000000..c9cf841 --- /dev/null +++ b/src/main/java/com/tetras/Rond.java @@ -0,0 +1,7 @@ +package com.tetras; + +public class Rond { + public void dessiner() { + System.out.println("Rond dessiné"); + } +} \ No newline at end of file diff --git a/src/main/resources/TODO.txt b/src/main/resources/TODO.txt new file mode 100644 index 0000000..390c386 --- /dev/null +++ b/src/main/resources/TODO.txt @@ -0,0 +1 @@ +Remove me \ No newline at end of file diff --git a/src/test/java/com/tetras/DessinTest.java b/src/test/java/com/tetras/DessinTest.java new file mode 100644 index 0000000..96342bf --- /dev/null +++ b/src/test/java/com/tetras/DessinTest.java @@ -0,0 +1,45 @@ +package com.tetras; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import java.io.PrintWriter; +import java.io.StringWriter; + +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +public class DessinTest { + + private final ByteArrayOutputStream outContent = new ByteArrayOutputStream(); + private final PrintStream originalOut = System.out; + + @BeforeEach + public void setUpStreams() { + System.setOut(new PrintStream(outContent)); + } + + @AfterEach + public void restoreStreams() { + System.setOut(originalOut); + } + + @Test + public void testDessiner() { + // + Dessin dessin = new Dessin(); + dessin.ajouter(new Rond()); + dessin.ajouter(new Carre()); + dessin.dessiner(); + // + StringWriter out = new StringWriter(); + PrintWriter writer = new PrintWriter(out); + writer.println("Rond dessiné"); + writer.println("Carré dessiné"); + writer.println("Dessin dessiné"); + // + assertEquals(out.toString(), outContent.toString()); + } +} \ No newline at end of file diff --git a/src/uml/composition.puml b/src/uml/composition.puml new file mode 100644 index 0000000..8ded402 --- /dev/null +++ b/src/uml/composition.puml @@ -0,0 +1,13 @@ +@startuml Composite +class Carre { + + dessiner() :void +} +class Rond { + + dessiner() :void +} +class Dessin { + + dessiner():void + + ajouter(Rond): void + + ajouter(Carre): void +} +@enduml \ No newline at end of file