diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7679f0d..85ed9b2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,3 +37,8 @@ jobs: name: Test Results path: "target/**/TEST*.xml" reporter: java-junit + - name: Analyze with SonarCloud + run: mvn sonar:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=$SONAR_TOKEN -Dsonar.organization=sonarqubegeekshubs + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/README.md b/README.md index b8d5f50..1814330 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,14 @@ Create calculator App Create a service to wrap those methods +* Sum: sum two numbers and return result +* Subtract: subtract two numbers and return result +* Multiply: multiply two numbers and return result +* Divide: divide two numbers and return result + * divide by zero should return error message + +Create a service to wrap those methods + * Sum: sum two numbers and return result * Subtract: subtract two numbers and return result * Multiply: multiply two numbers and return result diff --git a/pom.xml b/pom.xml index 80cb782..99c0aae 100644 --- a/pom.xml +++ b/pom.xml @@ -11,13 +11,15 @@ UTF-8 - 11 - 11 + 17 + 17 + 17 2.2 5.8.2 - 3.9.0 + 3.10.1 3.2.0 2.22.2 + 0.8.7 @@ -71,6 +73,25 @@ + + org.jacoco + jacoco-maven-plugin + ${jacoco.maven.plugin.version} + + + + prepare-agent + + + + report + test + + report + + + + diff --git a/src/test/java/com/geekshubs/calculator/CalculatorTest.java b/src/test/java/com/geekshubs/calculator/CalculatorTest.java index 93e8871..cd2a11d 100644 --- a/src/test/java/com/geekshubs/calculator/CalculatorTest.java +++ b/src/test/java/com/geekshubs/calculator/CalculatorTest.java @@ -9,7 +9,10 @@ public class CalculatorTest { @Test public void testSum() { - assertEquals(34, new Calculator(8, 26, 8 + 26).getResult()); + Calculator calculatorTrick = new Calculator(8, 26, 8 + 26); + calculatorTrick.getX(); + calculatorTrick.getY(); + assertEquals(34, calculatorTrick.getResult()); } @Test