HELP WITH EXAMPLES OF THE METHODS, IN THE TODO package integerarraylist; import static org.junit.jupiter.api.Assertions.*; import java.util.ArrayList; import org.junit.jupiter.api.Test; class CustomIntegerArrayListTest { @Test void testGetArrayList() { //create a new empty CustomIntegerArrayList CustomIntegerArrayList arr1 = new CustomIntegerArrayList(); arr1.add(2); arr1.add(0, 5); arr1.add(1, 5); ArrayList lst1 = new ArrayList(); lst1.add(2); lst1.add(0, 5); lst1.add(1, 5); assertEquals(lst1, arr1.getArrayList()); ArrayList arr4Elements = new ArrayList(); arr4Elements.add(100); arr4Elements.add(200); arr4Elements.add(500); //create a new CustomIntegerArrayList with the elements in the given ArrayList CustomIntegerArrayList arr4 = new CustomIntegerArrayList(arr4Elements); ArrayList lst4 = new ArrayList(); lst4.add(100); lst4.add(200); lst4.add(500); assertEquals(lst4, arr4.getArrayList()); // TODO write at least 3 additional test cases } @Test void testGet() { CustomIntegerArrayList arr1 = new CustomIntegerArrayList(); arr1.add(2); arr1.add(0, 5); arr1.add(1, 5); ArrayList lst1 = new ArrayList(); lst1.add(2); lst1.add(0, 5); lst1.add(1, 5); assertEquals(lst1.get(0), arr1.get(0)); assertEquals(lst1.get(1), arr1.get(1)); assertEquals(lst1.get(2), arr1.get(2)); // TODO write at least 3 additional test cases } @Test void testAddInt() { CustomIntegerArrayList arr1 = new CustomIntegerArrayList(); arr1.add(2); arr1.add(3); arr1.add(4); ArrayList lst1 = new ArrayList(); lst1.add(2); lst1.add(3); lst1.add(4); assertEquals(lst1.get(0), arr1.get(0)); assertEquals(lst1.get(1), arr1.get(1)); assertEquals(lst1.get(2), arr1.get(2)); // TODO write at least 3 additional test cases } @Test void testAddIntInt() { CustomIntegerArrayList arr1 = new CustomIntegerArrayList(); arr1.add(0, 2); arr1.add(0, 3); arr1.add(0, 4); ArrayList lst1 = new ArrayList(); lst1.add(0, 2); lst1.add(0, 3); lst1.add(0, 4); assertEquals(lst1.get(0), arr1.get(0)); assertEquals(lst1.get(1), arr1.get(1)); assertEquals(lst1.get(2), arr1.get(2)); // TODO write at least 3 additional test cases } @Test void testRemoveInt() { CustomIntegerArrayList arr1 = new CustomIntegerArrayList(); arr1.add(0, 2); arr1.add(0, 3); arr1.add(0, 4); arr1.remove(0); arr1.remove(1); ArrayList lst1 = new ArrayList(); lst1.add(0, 2); lst1.add(0, 3); lst1.add(0, 4); lst1.remove(0); lst1.remove(1); assertEquals(lst1.get(0), arr1.get(0)); // TODO write at least 3 additional test cases } @Test void testRemoveIntInt() { CustomIntegerArrayList arr1 = new CustomIntegerArrayList(); arr1.add(0, 2); arr1.add(0, 3); arr1.add(0, 3); arr1.add(0, 3); arr1.add(0, 3); arr1.add(0, 4); arr1.remove(3, 3); ArrayList lst1 = new ArrayList(); lst1.add(0, 2); lst1.add(0, 3); lst1.add(0, 4); assertEquals(lst1, arr1.getArrayList()); // TODO write at least 3 additional test cases } @Test void testSpliceIntInt() { CustomIntegerArrayList arr1 = new CustomIntegerArrayList(); arr1.add(2); arr1.add(3); arr1.add(4); arr1.add(5); arr1.add(6); arr1.splice(3, 2); ArrayList lst1 = new ArrayList(); lst1.add(2); lst1.add(3); lst1.add(4); assertEquals(lst1.get(0), arr1.get(0)); assertEquals(lst1.get(1), arr1.get(1)); assertEquals(lst1.get(2), arr1.get(2)); // TODO write at least 3 additional test cases } @Test void testSpliceIntIntIntArray() { CustomIntegerArrayList arr1 = new CustomIntegerArrayList(); arr1.add(2); arr1.add(3); arr1.add(4); arr1.add(5); arr1.add(6); arr1.splice(3, 1, new int[] { 4, 5 }); ArrayList lst1 = new ArrayList(); lst1.add(2); lst1.add(3); lst1.add(4); lst1.add(4); lst1.add(5); lst1.add(6); assertEquals(lst1, arr1.getArrayList()); // TODO write at least 3 additional test cases } }

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
HELP WITH EXAMPLES OF THE METHODS, IN THE TODO
 
package integerarraylist;

import static org.junit.jupiter.api.Assertions.*;

import java.util.ArrayList;

import org.junit.jupiter.api.Test;

class CustomIntegerArrayListTest {

@Test
void testGetArrayList() {
 
//create a new empty CustomIntegerArrayList
CustomIntegerArrayList arr1 = new CustomIntegerArrayList();
arr1.add(2);
arr1.add(0, 5);
arr1.add(1, 5);
 
ArrayList<Integer> lst1 = new ArrayList<Integer>();
lst1.add(2);
lst1.add(0, 5);
lst1.add(1, 5);
assertEquals(lst1, arr1.getArrayList());

ArrayList<Integer> arr4Elements = new ArrayList<Integer>();
arr4Elements.add(100);
arr4Elements.add(200);
arr4Elements.add(500);
 
//create a new CustomIntegerArrayList with the elements in the given ArrayList
CustomIntegerArrayList arr4 = new CustomIntegerArrayList(arr4Elements);

ArrayList<Integer> lst4 = new ArrayList<Integer>();
lst4.add(100);
lst4.add(200);
lst4.add(500);

assertEquals(lst4, arr4.getArrayList());
 
// TODO write at least 3 additional test cases
}

@Test
void testGet() {
CustomIntegerArrayList arr1 = new CustomIntegerArrayList();
arr1.add(2);
arr1.add(0, 5);
arr1.add(1, 5);
 
ArrayList<Integer> lst1 = new ArrayList<Integer>();
lst1.add(2);
lst1.add(0, 5);
lst1.add(1, 5);

assertEquals(lst1.get(0), arr1.get(0));
assertEquals(lst1.get(1), arr1.get(1));
assertEquals(lst1.get(2), arr1.get(2));

// TODO write at least 3 additional test cases
}

@Test
void testAddInt() {
 
CustomIntegerArrayList arr1 = new CustomIntegerArrayList();
arr1.add(2);
arr1.add(3);
arr1.add(4);
 
ArrayList<Integer> lst1 = new ArrayList<Integer>();
lst1.add(2);
lst1.add(3);
lst1.add(4);

assertEquals(lst1.get(0), arr1.get(0));
assertEquals(lst1.get(1), arr1.get(1));
assertEquals(lst1.get(2), arr1.get(2));

// TODO write at least 3 additional test cases
}

@Test
void testAddIntInt() {
 
CustomIntegerArrayList arr1 = new CustomIntegerArrayList();
arr1.add(0, 2);
arr1.add(0, 3);
arr1.add(0, 4);
 
ArrayList<Integer> lst1 = new ArrayList<Integer>();
lst1.add(0, 2);
lst1.add(0, 3);
lst1.add(0, 4);

assertEquals(lst1.get(0), arr1.get(0));
assertEquals(lst1.get(1), arr1.get(1));
assertEquals(lst1.get(2), arr1.get(2));

// TODO write at least 3 additional test cases
}

@Test
void testRemoveInt() {

CustomIntegerArrayList arr1 = new CustomIntegerArrayList();
arr1.add(0, 2);
arr1.add(0, 3);
arr1.add(0, 4);
arr1.remove(0);
arr1.remove(1);
 
ArrayList<Integer> lst1 = new ArrayList<Integer>();
lst1.add(0, 2);
lst1.add(0, 3);
lst1.add(0, 4);
lst1.remove(0);
lst1.remove(1);
 
assertEquals(lst1.get(0), arr1.get(0));

// TODO write at least 3 additional test cases
}

@Test
void testRemoveIntInt() {

CustomIntegerArrayList arr1 = new CustomIntegerArrayList();
arr1.add(0, 2);
arr1.add(0, 3);
arr1.add(0, 3);
arr1.add(0, 3);
arr1.add(0, 3);
arr1.add(0, 4);
arr1.remove(3, 3);
 
ArrayList<Integer> lst1 = new ArrayList<Integer>();
lst1.add(0, 2);
lst1.add(0, 3);
lst1.add(0, 4);

assertEquals(lst1, arr1.getArrayList());

// TODO write at least 3 additional test cases
}

@Test
void testSpliceIntInt() {

CustomIntegerArrayList arr1 = new CustomIntegerArrayList();
arr1.add(2);
arr1.add(3);
arr1.add(4);
arr1.add(5);
arr1.add(6);
arr1.splice(3, 2);
 
ArrayList<Integer> lst1 = new ArrayList<Integer>();
lst1.add(2);
lst1.add(3);
lst1.add(4);

assertEquals(lst1.get(0), arr1.get(0));
assertEquals(lst1.get(1), arr1.get(1));
assertEquals(lst1.get(2), arr1.get(2));

// TODO write at least 3 additional test cases
}

@Test
void testSpliceIntIntIntArray() {
 
CustomIntegerArrayList arr1 = new CustomIntegerArrayList();
arr1.add(2);
arr1.add(3);
arr1.add(4);
arr1.add(5);
arr1.add(6);
arr1.splice(3, 1, new int[] { 4, 5 });
 
ArrayList<Integer> lst1 = new ArrayList<Integer>();
lst1.add(2);
lst1.add(3);
lst1.add(4);
lst1.add(4);
lst1.add(5);
lst1.add(6);
 
assertEquals(lst1, arr1.getArrayList());

// TODO write at least 3 additional test cases
}

}
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 6 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY