- 1. Write test to validate that the team has only 4 foreign players
- 2. Write test to validate that their is atleast 1 wicket keeper
Dependency | Version | Feature |
Java | 19 | Programming languages |
TestNG | 7.6.1 | Test cases |
jackson-databind | 2.14.1 | JSON Object Mapper to convert JSON object to Pojo Class Object |
lombok | 1.18.24 | Annotations used to enable a Pojo class with getters and getters |
OOPs Concept | Implementation | Advantages |
Interface | IJsonService.java | Overriden methods gives capability to have runtime(dynamic) Polymorphism |
Abstract Class | PlayerServiceImpl.java | This abstract class having abstract methods making it very dynamic keeping future enhancements in mind |
Inheritence | TeamServiceImpl.java | By implementing IJsonService.java and extending PlayerServiceImpl.java, this class gives framework flexibility implement overriden methods and also to overload those methods |
Java 8 concepts | Streams | Used to collect Objects as Arrays streams, apply filters, return distinct elements, count of elements |
java.nio.file.Path | Paths.get("src", "test", "resources") | Used to get a path based on the folder name,filter files based on fileName |
- src/main/java
- ipl.lib.json.objects.Player.java
ipl.lib.json.objectsTeam.java- ipl.team.IJsonServiceImpl.java
- ipl.team.PlayerServiceImpl.java
- ipl.team.teamServiceImpl.java
- src/test/java
- tests.TestTeamPlayerDetails.java
TestNG Annotation | Method | Implementation Purpose |
BeforeClass | submitTeamPlayerDetails | This method executes once for all those @Test methods in this class. So, submitting TeamRCB.json file logic is handle here so that teamRCB data is available for all testcases related to Team RCB |
Test | validateTeamHasForeignPlayersCount | This Testcase is to validate if team is having expected foreign players |
Test | validateTeamHasRolePlayer | This Testcase is to validate if team is having expected wicket-keeping players |
AfterClass | approveTeam | This method executes once after all test cases executed in this class scope. Soft assertion is handled here to validate the team submitted to approve without any issues |
Mode Of Execution | Steps to Execute |
---|---|
TestNG : @Test method | Right click on @Test method, execute. |
Maven command | mvn clean test |
Tests Reports | Location |
---|---|
TestNG Reports | target/surefire-reports/ |