Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
69 lines (50 sloc) 2.38 KB

AddressBook Level 1 - Developer Guide

Setting up

Prerequisites

  • JDK 9 or later

  • IntelliJ IDE

Importing the project into IntelliJ

  1. Open IntelliJ (if you are not in the welcome screen, click File > Close Project to close the existing project dialog first)

  2. Set up the correct JDK version

    1. Click Configure > Project Defaults > Project Structure

    2. If JDK 9 is listed in the drop down, select it. If it is not, click New…​ and select the directory where you installed JDK 9

    3. Click OK

  3. Click Import Project

  4. Locate the project directory and click OK

  5. Select Create project from existing sources and click Next

  6. Rename the project if you want. Click Next

  7. Ensure that your src folder is checked. Keep clicking Next

  8. Click Finish

Design

AddressBook saves data in a plain text file, one line for each person, in the format NAME p/PHONE e/EMAIL. Here is an example:

John Doe p/98765432 e/johnd@gmail.com
Jane Doe p/12346758 e/jane@gmail.com

All person data are loaded to memory at start up and written to the file after any command that mutates data. In-memory data are held in a ArrayList<String[]> where each String[] object represents a person.

Testing

Windows

  1. Open a DOS window in the test folder

  2. Run the runtests.bat script

  3. If the script reports that there is no difference between ACTUAL.TXT and EXPECTED.TXT, the test has passed

Mac/Unix/Linux

  1. Open a terminal window in the test folder

  2. Run the runtests.sh script

  3. If the script reports that there is no difference between ACTUAL.TXT and EXPECTED.TXT, the test has passed

Troubleshooting

  • Problem: How do I examine the exact differences between ACTUAL.TXT and EXPECTED.TXT?
    Solution: You can use a diff/merge tool with a GUI e.g. WinMerge (on Windows).

  • Problem: The two files look exactly the same, but the test script reports they are different.
    Solution: This can happen because the line endings used by Windows is different from Unix-based OSes. Convert the ACTUAL.TXT to the format used by your OS using some utility.

  • Problem: Test fails during the very first time.
    Solution: The output of the very first test run could be slightly different because the program creates a new storage file. Tests should pass from the 2nd run onwards.

You can’t perform that action at this time.