Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 24 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<java.version>17</java.version>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<hamcrest.version>2.2</hamcrest.version>
<junit.version>5.8.2</junit.version>
<maven-compiler-plugin.version>3.9.0</maven-compiler-plugin.version>
<maven-compiler-plugin.version>3.10.1</maven-compiler-plugin.version>
<maven.resources.plugin.version>3.2.0</maven.resources.plugin.version>
<maven.surefire.plugin.version>2.22.2</maven.surefire.plugin.version>
<jacoco.maven.plugin.version>0.8.7</jacoco.maven.plugin.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -71,6 +73,25 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.maven.plugin.version}</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
5 changes: 4 additions & 1 deletion src/test/java/com/geekshubs/calculator/CalculatorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down