Skip to content

Latest commit

 

History

History
49 lines (37 loc) · 5.5 KB

readme.md

File metadata and controls

49 lines (37 loc) · 5.5 KB

Ui module

The ui module is responsible for the application's frontend. It is built using JavaFX and FXML. It uses FXML files and their respected controller for navigating between scenes. The frontend is responsible for displaying the recipes in the cookbook, adding a recipe, editing a recipe and deleting a recipe. The ui module requires access to the core, springboot and persistence module in order to function properly. It is set up to work with either a localy stored cookbook file or using requests to a REST-API.


Packages:

  • cookbook.ui - Contains the Controller classes for the different scenes in the application. As well as the main class for running the application.
  • coookbook.accessdata - Contains the logic for reading and writing to the json file. This package contains two classes, one for reading and writing to a local json file and one for reading and writing to a remote json file. Both implementing the same CookbookAccess interface for use in the controllers.

Classes:

Tests:


Testing the UI

  • The CookbookAppTest uses FxRobot for testing the apps GUI. It provides assurance that actions in the app lead to the correct outcome. What one presses in the app should correspond to what is expected to happen. The tests are performed by using the onClick() command with the elements' CSS ids.
  • The LocalCookbookAccessTest tests that the methods defined in the CookbookAccess interface works, and can be implemented using the CookbookHandler class from the persistence module together with some additional logic. This test ensures that we can safely use the LocalCookbookAccess object if the app fails to connect to the REST-API.
  • In RemoteCookbookAccessTest we use WireMock to mock the server, defining the expected requests and responses. This test ensures that the RemoteCookbookAccess exception handling in works as intended. This test primary focus is to ensure that the RemoteCookbookAccess throws a RuntimeException if it recives a non 200(OK) response from the server. It also checks that the RemoteCookbookAccess class is able to fetch a json cookbook from the server and convert it to the right Cookbook object.

Class Diagram:

Class Diagram


Important Dependecies

  • Core
  • Persistence
  • WireMock
  • JavaFX

This module has its own pom.xml file, which is responsible for building the module with its respected dependencies and plugins, such as JaCoCo, Checkstyle and Spotbugs, WireMock and JavaFX.


< Return to Cookbook Project