From ae7810dd7401020577a0619bf73881bc8e9f7a61 Mon Sep 17 00:00:00 2001
From: arnaudlabourel <arnaud.labourel@univ-amu.fr>
Date: Mon, 25 Sep 2023 15:36:16 +0200
Subject: [PATCH] added config files

---
 build.gradle                       |  8 +++++++-
 gradle.properties                  |  1 +
 src/main/java/curve/App.java       |  1 +
 src/test/java/curve/CurveTest.java | 15 +++++++--------
 4 files changed, 16 insertions(+), 9 deletions(-)
 create mode 100644 gradle.properties

diff --git a/build.gradle b/build.gradle
index 9fff65d..1e2a09a 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,7 +1,9 @@
 plugins {
-    id "java"
+    id 'application'
 }
 
+apply plugin : "java"
+
 group 'L3_INFO'
 version '1.0-SNAPSHOT'
 
@@ -19,3 +21,7 @@ test {
     useJUnitPlatform()
 }
 
+application {
+    mainClass = 'curve.App'
+}
+
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..03b2e37
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1 @@
+org.gradle.warning.mode=all
\ No newline at end of file
diff --git a/src/main/java/curve/App.java b/src/main/java/curve/App.java
index 8263961..0c7077c 100644
--- a/src/main/java/curve/App.java
+++ b/src/main/java/curve/App.java
@@ -21,6 +21,7 @@ public class App {
         Runtime runtime = Runtime.getRuntime();
         String[] arguments = {"gnuplot", "-persist"};
         Process process = runtime.exec(arguments);
+
         Writer stream = new OutputStreamWriter(process.getOutputStream());
         writeGnuplotInput(stream, curve);
     }
diff --git a/src/test/java/curve/CurveTest.java b/src/test/java/curve/CurveTest.java
index 6d593d8..1f68cf4 100644
--- a/src/test/java/curve/CurveTest.java
+++ b/src/test/java/curve/CurveTest.java
@@ -1,13 +1,12 @@
 package curve;
 
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.*;
-
 import java.io.IOException;
 import java.io.StringWriter;
 import java.io.Writer;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.*;
 
 import formula.Sum;
 import formula.Variable;
@@ -15,7 +14,7 @@ import formula.Variable;
 public class CurveTest {
 
     @Test
-    public void test() throws IOException {
+    void test() throws IOException {
         Variable variable = new Variable("variable", 0);
         Function function = new Function(new Sum(variable, variable), variable);
         double startValue = -1;
@@ -27,11 +26,11 @@ public class CurveTest {
         writer.close();
 
         StringBuilder stringBuilder = new StringBuilder();
-        for (double value = startValue; value <= endValue; value+=step) {
-            stringBuilder.append(value+" "+2*value+"\n");
+        for (double value = startValue; value <= endValue; value += step) {
+            stringBuilder.append(value).append(" ").append(2 * value).append("\n");
         }
 
-        assertThat(writer.toString(), equalTo(stringBuilder.toString()));
+        assertThat(writer.toString()).isEqualTo(stringBuilder.toString());
     }
 
 }
-- 
GitLab