Question
To complete the assignment, remove the calls to fail() in TestArray.java and follow along with comments to complete the test methods. You will not need
To complete the assignment, remove the calls to fail() in TestArray.java and follow along with comments to complete the test methods. You will not need to modify Array.java at all. When complete, upload your copy of TestArray.java.
Array.java
public class Array
TestArray.java
import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.Test; class TestArray { @Test void testConstructor() { // Base case: Call the constructor with a valid length. Ensure that the // constructed object is the desired length and that each element is // initially null. // // Edge case: Call the constructor with a length of zero and ensure it // has the desired length. // // Edge case: Check that the constructor throws the documented // exception when call with a negative length. fail("Not yet implemented"); } @Test void testSetThenGet() { // Set up: Construct an Array with a small number of elements. // // Base case: For each index in the array, set it to a value and then // that get returns that new value. You should also verify that it is // only the element at that index was changed. // // Edge case: Check that both get and set throw the documented // exception when passed an illegal index (both too large and // negative). fail("Not yet implemented"); } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started