Answered step by step
Verified Expert Solution
Question
1 Approved Answer
import java.util.ArrayList; import java.util.Arrays; import java.util.NoSuchElementException; public class Contact { private ArrayList contacts; private String contactName; public Contact ( ) { throw new NoSuchElementException (
"import java.util.ArrayList;
import java.util.Arrays;
import java.util.NoSuchElementException;
public class Contact
private ArrayList contacts;
private String contactName;
public Contact
throw new NoSuchElementException;
public ContactString name
this.contactName name;
contacts new ArrayList;
public String getName
return contactName;
public boolean nameMatchesString search
return contactName.toLowerCasecontainssearch;
public void addContactInformationString contactInfo
contacts.addcontactInfo;
public String getContactInformation
String contactsArr new Stringcontactssize;
for int i ; i contacts.size; i
contactsArri contacts.geti;
return contactsArr;
@Override
public String toString
return Arrays.toStringgetContactInformation;
Write a unit test TestContactjava that calls each of the methods in your Contact class at least once. For each method call that returns a value, your unit test must do at least one of two things: compare the results of the call to what is expected, then at the end print whether all the results are as expected, or print the result of each method call."PN
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