[SOLVED] 代写 Java junit CSCI 2134 Lab 7: Assertions and Exceptions

30 $

File Name: 代写_Java_junit_CSCI_2134_Lab_7:_Assertions_and_Exceptions.zip
File Size: 565.2 KB

SKU: 4913221324 Category: Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Or Upload Your Assignment Here:


CSCI 2134 Lab 7: Assertions and Exceptions
Fall 2019
Objective
In this lab, you will work on your own or with another student to improve the robustness of existing code using exceptions and assertions.
The lab will be due by 11:59pm on Wednesday, October 30, 2019 in the git central repository.
Preparation
Ensure that you have your Integrated Development Editors (IDE) for Java installed. Ensure that you still have a copy of the project from assignment 2 / lab 6 from
https://git.cs.dal.ca/courses/2019-fall/csci-2134/assignment-2/xxxx.git
using the action File→New→Project from Version Control→Git. Replace xxxx with your CSID (for bluenose).
Do the work of this lab in the assertions branch of the repository!
Review the documentation on the problem being solved in the external documentation of the source tree. Also review the code of the class you will be fixing (grid.java) and the unit tests (gridTest.java). Thesefilesarelocatedinthesrcandtestdirectoriesofthecloned project.
Resources
• The source code in the project for this lab: https://git.cs.dal.ca/courses/2019-fall/csci-2134/assignment- 2/xxxx.git where you replace xxxx with your CSID
Procedure
Set-up
1. Open the project you created in preparation for this lab
2. Ensure that your git settings have you working in the assertions branch of the
repository.
3. Do a git “pull” operation to retrieve any updates to the code
4. (optional step) Since we will be building on the code from lab 6, you may want to merge
your “refactoring” branch with your “assertions” branch so that you have all the updates from your last lab. This step is not mandatory; you can complete this lab without the refactorings from lab 6.
5. Be sure to schedule your tasks during the lab. Keep an eye on the time and ensure that you save some time at the end of the labs to do the analysis.

Part 1: Exceptions
1. Each of addPuzzleWord, getWord, and setWord return a coarse form of return code as success or failure of the methods. Update the methods to throw an exception in appropriate exceptional cases. Select exceptions that provide more meaning about the nature of the error condition. Exceptions for the methods include
o addPuzzleWord – falling off the grid should return an IndexOutOfBoundsException
o setWord, getWord – a with addPuzzleWord; also, if we start in the middle of a word then issue an IllegalArgumentException
2. Update the methods in fillInPuzzle.java to handle these exceptions as appropriate when it is calling these methods.
3. Update any JUnit tests to properly deal with testing the exceptions.
4. Commit and push the update to the repository.
Part 2: Assertions
1. Augment the while and inner for loops inside the solve method in fillInPuzzle.java to have preconditions, loop invariants, and postconditions. Use assert statements for this work.
2. Commit and push the updates to the repository.
Analysis
Identify the hardest part of changing the return codes to exceptions. How did you deal with it? How are did you proceed with finding good assert statements for the assertion part of the lab?
Reporting
1. Add your analysis to a new text file in the repository called assertions.txt.
2. List all the members of your team at the start of the assertions.txt file.
3. Add assertions.txt to the repository then commit and push the project.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] 代写 Java junit CSCI 2134 Lab 7: Assertions and Exceptions
30 $