Missing code

We are going to rewrite RemApp to fill out to do the “bigger” scenario from the test-driven development notes. I have re-organized the code again a little to help support using the Model-View separation concept based on the Model-View-Controller architecture. You will also write your first JUnit test cases:

  • Download the files for the lab and put them into a new project.
  • Add a new JUnit test class to the project, consoleKit.TestMenuStack:

o   If you are using NetBeans, check the Test Initializer box when creating the class

o   Declare a MenuStack (the files include a skeleton of the class) variable and two Menu variables. The first will be the “parent” menu of the 2nd.

o   In an initializer function (annotated by @Before)

  • Initialize the MenuStack
  • Then initialize the Menu’s using this MenuStack
  • When you write MenuStack, you will be pushing the Menu’s onto a stack inside the constructor of the Menu

o   Define a test function (include the @Test annotation) that uses assertEquals() to confirm that the current menu for the MenuStack equals the 2nd menu initialized

o   Fill in MenuStack so that this test case passes.

o   Define a second test case checks for returning to the previous menu:

  • Create a ReturnFromMenumenu item, initializing it with the name of the first Menu and the MenuStack
  • Add this menu item to the 2ndMenu
  • Call the menu item’s execute() function
  • Use assertEquals() to confirm the current menu is now the parent menu

o   Fill in the missing elements of MenuStack and ReturnFromMenu to get this case to pass

  • Run RemAppto see that the program is now functioning correctly. See below for an additional scenario to check the proper return from a nested menu
  • Submit your work – because you want TestMenuStackto be included, it is easiest to zip up the whole project folder so that both src and test folders are included

Grading:

40% TestMenuStack

40% MenuStack

20% ReturnFromMenu

(no need to add comments)

  • Here is the additional scenario:

Reminders, version 0.1

 

Options:

  1. Quit
  2. List today’s reminders
  3. Add a new category of reminders
  4. Choose a category to work with

Enter an option (0-3): 3

 

Options:

  1. Personal

Enter an option (0-0): 0

 

Options:

  1. Quit
  2. Return to main menu
  3. List all reminders
  4. Add a reminder

Enter an option (0-3): 1

 

Options:

  1. Quit
  2. List today’s reminders
  3. Add a new category of reminders
  4. Choose a category to work with

Enter an option (0-3): 0

 

Last Updated on February 10, 2019 by EssayPro