Skip to content

Commit

Permalink
Add testDivisionAndSubtraction integration test case
Browse files Browse the repository at this point in the history
  • Loading branch information
indikaeranga committed Feb 27, 2024
1 parent 66deb8f commit 1d438df
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
17 changes: 13 additions & 4 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions src/test/java/TestCalculator.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,16 @@ public void testAdditionAndMultiplication(int mulParam1, int mulParam2, int addP
// Assert that the total result matches the expected result
Assertions.assertEquals(expectedResult, totalResult);
}
@ParameterizedTest
@CsvFileSource(resources = "/TestData_DivisionAndSubtraction.csv")
public void testDivisionAndSubtraction(int subParam1, int subParam2, int divParam, int expectedResult) {
// Perform the subtraction
int subResult = main.Substract(subParam1, subParam2);
// Perform the division with the result of subtraction
int divResult = main.Divide(subResult, divParam);
// Assert that the result of division matches the expected result
Assertions.assertEquals(expectedResult, divResult);
}


}
2 changes: 2 additions & 0 deletions src/test/resources/TestData_DivisionAndSubtraction.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
8,2,3,2
10,5,1,5

0 comments on commit 1d438df

Please sign in to comment.