LeNelSoN / you-are-the-hero

L'API dont vous êtes le héros is an interactive Java API that brings the adventure of "choose your own adventure" stories to life. Users can embark on unique journeys, make decisions at each step, and create dynamic narratives, all while experiencing the nostalgia of classic adventure books.
GNU General Public License v3.0
2 stars 10 forks source link

Write Unit Tests for SceneService #9

Closed LeNelSoN closed 2 months ago

LeNelSoN commented 2 months ago

Quest:

Develop unit tests for the SceneService class to ensure that scene management functionalities work correctly, including adding new scenes and retrieving scenes by ID.

Tasks:

  • [ ] Verify that a new scene can be added successfully to an existing parent scene.
  • [ ] Ensure that a Scene is created and associated with the correct parent scene.
  • [ ] Validate that the method throws an exception when trying to add a scene to a non-existent parent scene.
  • [ ] Check that the choices are correctly added to the parent scene.
  • [ ] Test successful retrieval of a scene by its ID when it exists.
  • [ ] Validate that it throws a RuntimeException when the scene does not exist.

image

The keeper of the repo 🏰

RomeoIndiaJulietUniform commented 2 months ago

Hii @LeNelSoN I add the unit tests for the Scene Service which covers the following :

1.The testAddNewScene_Success() method verifies that a new scene can be added to an existing parent scene, ensuring the correct creation of the child scene and updating of the parent scene's choices.

2.The testAddNewScene_ParentSceneNotFound() method checks that an exception is thrown when attempting to add a scene to a non-existent parent.

3.The testGetSceneById_Success() and testGetSceneById_SceneNotFound() methods test the retrieval of scenes by ID, confirming successful retrieval when the scene exists and proper exception handling when it doesn't.

Also added a .gitignore file. Please let me know if there are any additional tasks or improvements that need to be addressed. I'm open to any suggestions!