SlideShare a Scribd company logo
I need help in writing the test cases of the below methods in java. The test cases must test
both empty and non empty deque.PLS HELP ME WITH WRITING THE TEST CASES IN
JAVA.ITS URGENT.
package deque;
/**
* A deque implemented using a doubly-linked chain.
*
* @param <T>
* The type of elements contained in the deque.
*/
public class Lab08Deque<T> extends DLinkedDeque<T> {
/**
* Inserts a new item at the front of the deque.
*
* @param newEntry
* the item to insert.
*/
public void addToFront(T newEntry) {
DLNode<T> newNode = new DLNode<T>(newEntry);
if (isEmpty()) {
lastNode = newNode;
}
else {
firstNode.setPreviousNode(newNode);
}
newNode.setNextNode(firstNode);
firstNode = newNode;
size++;
throw new UnsupportedOperationException(
"You have not implemented addToFront() yet");
}
/**
* Insert a new item at the rear of the deque.
*
* @param newEntry
* the item to insert.
*/
public void addToBack(T newEntry) {
DLNode<T> newNode = new DLNode<T>(newEntry);
if (isEmpty()) {
firstNode = newNode;
}
else {
lastNode.setPreviousNode(newNode);
newNode.setPreviousNode(lastNode);
}
lastNode = newNode;
size++;
throw new UnsupportedOperationException(
"You have not implemented addToBack() yet");
}
/**
* Remove the item at the front of the deque.
*
* @return The item that was removed
* @throws EmptyQueueException
* if there is not an element at the front
*/
public T removeFront() {
if (isEmpty()) {
throw new EmptyQueueException();
}
T front = firstNode.getData();
firstNode = firstNode.getNextNode();
if (firstNode == null) {
lastNode = null;
}
else {
firstNode.setPreviousNode(null);
}
throw new UnsupportedOperationException(
"You have not implemented removeFront() yet");
}
/**
* Remove the item at the rear of the deque.
*
* @return The item that was removed
* @throws EmptyQueueException
* if there is no element at the front
*/
public T removeBack() {
if (isEmpty()) {
throw new EmptyQueueException();
}
T data = lastNode.getData();
lastNode = lastNode.getPreviousNode();
if (lastNode == null) {
firstNode = null;
}
else {
lastNode.setPreviousNode(null);
}
throw new UnsupportedOperationException(
"You have not implemented removeBack() yet");
}
/**
* Get the item at the front (the head) of the deque. Does not alter the
* deque.
*
* @return the item at the front of the deque.
* @throws EmptyQueueException
* if no element at the front
*/
public T getFront() {
if (isEmpty()) {
throw new EmptyQueueException();
}
return firstNode.getData();
}
/**
* Get the item at the rear (the tail) of the deque. Does not alter the
* deque.
*
* @return the item at the rear of the deque.
* @throws EmptyQueueException
* if no element at rear
*
*/
public T getBack() {
if (isEmpty()) {
throw new EmptyQueueException();
}
return lastNode.getData();
}
/**
* Check if the deque is empty
*
* @return true if the deque has no items
*/
public boolean isEmpty() {
return size() == 0;
}
/**
* Empty the deque.
*/
public void clear() {
while (!isEmpty()) {
removeFront();
}
}
// ----------------------------------------------------------
/**
* Returns a string representation of this deque. A deque's string
* representation is written as a comma-separated list of its contents (in
* front-to-rear order) surrounded by square brackets, like this:
*
* [52, 14, 12, 119, 73, 80, 35]
*
* An empty deque is simply [].
*
* @return a string representation of the deque
*/
@Override
public String toString() {
StringBuilder s = new StringBuilder();
s.append("[");
DLNode<T> p = firstNode;
while (p != null) {
if (s.length() > 1) {
s.append(", ");
}
s.append(p.getData());
p = p.getNextNode();
}
s.append("]");
return s.toString();
}
}

More Related Content

Similar to I need help in writing the test cases of the below methods i.pdf

How do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdf
How do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdfHow do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdf
How do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdf
mail931892
 
package algs13;import stdlib.;import java.util.Iterator;im.docx
package algs13;import  stdlib.;import java.util.Iterator;im.docxpackage algs13;import  stdlib.;import java.util.Iterator;im.docx
package algs13;import stdlib.;import java.util.Iterator;im.docx
gerardkortney
 
Given below is the completed implementation of MyLinkedList class. O.pdf
Given below is the completed implementation of MyLinkedList class. O.pdfGiven below is the completed implementation of MyLinkedList class. O.pdf
Given below is the completed implementation of MyLinkedList class. O.pdf
info430661
 
Add functions push(int n- Deque &dq) and pop(Deque &dq)- Functions pus.docx
Add functions push(int n- Deque &dq) and pop(Deque &dq)- Functions pus.docxAdd functions push(int n- Deque &dq) and pop(Deque &dq)- Functions pus.docx
Add functions push(int n- Deque &dq) and pop(Deque &dq)- Functions pus.docx
WilliamZnlMarshallc
 
Given the following ADT definition of a stack to use stack .docx
Given the following ADT definition of a stack to use stack .docxGiven the following ADT definition of a stack to use stack .docx
Given the following ADT definition of a stack to use stack .docx
shericehewat
 
Posfix
PosfixPosfix
Hi, Please find my code.I have correted all of your classes.Plea.pdf
Hi, Please find my code.I have correted all of your classes.Plea.pdfHi, Please find my code.I have correted all of your classes.Plea.pdf
Hi, Please find my code.I have correted all of your classes.Plea.pdf
pritikulkarni20
 
EmptyCollectionException-java -- - Represents the situation in which.docx
EmptyCollectionException-java --  - Represents the situation in which.docxEmptyCollectionException-java --  - Represents the situation in which.docx
EmptyCollectionException-java -- - Represents the situation in which.docx
BlakeSGMHemmingss
 
public class DoubleArraySeq implements Cloneable {    Priva.pdf
public class DoubleArraySeq implements Cloneable {     Priva.pdfpublic class DoubleArraySeq implements Cloneable {     Priva.pdf
public class DoubleArraySeq implements Cloneable {    Priva.pdf
annaimobiles
 
Please review my code (java)Someone helped me with it but i cannot.pdf
Please review my code (java)Someone helped me with it but i cannot.pdfPlease review my code (java)Someone helped me with it but i cannot.pdf
Please review my code (java)Someone helped me with it but i cannot.pdf
fathimafancyjeweller
 
I have a stack in Java populated with integers. Im trying to compa.pdf
I have a stack in Java populated with integers. Im trying to compa.pdfI have a stack in Java populated with integers. Im trying to compa.pdf
I have a stack in Java populated with integers. Im trying to compa.pdf
JUSTSTYLISH3B2MOHALI
 
AnswerNote Driver class is not given to test the DoubleArraySeq..pdf
AnswerNote Driver class is not given to test the DoubleArraySeq..pdfAnswerNote Driver class is not given to test the DoubleArraySeq..pdf
AnswerNote Driver class is not given to test the DoubleArraySeq..pdf
nipuns1983
 
In java , I want you to implement a Data Structure known as a Doubly.pdf
In java , I want you to implement a Data Structure known as a Doubly.pdfIn java , I want you to implement a Data Structure known as a Doubly.pdf
In java , I want you to implement a Data Structure known as a Doubly.pdf
aromalcom
 
import java-util-Iterator- import java-util-NoSuchElementException- im.pdf
import java-util-Iterator- import java-util-NoSuchElementException- im.pdfimport java-util-Iterator- import java-util-NoSuchElementException- im.pdf
import java-util-Iterator- import java-util-NoSuchElementException- im.pdf
Stewart29UReesa
 
Hi,I have added the methods and main class as per your requirement.pdf
Hi,I have added the methods and main class as per your requirement.pdfHi,I have added the methods and main class as per your requirement.pdf
Hi,I have added the methods and main class as per your requirement.pdf
annaelctronics
 
For the code below complete the preOrder() method so that it perform.pdf
For the code below complete the preOrder() method so that it perform.pdfFor the code below complete the preOrder() method so that it perform.pdf
For the code below complete the preOrder() method so that it perform.pdf
xlynettalampleyxc
 
How do I fix it in LinkedList.javathis is what i didLabProgra.pdf
How do I fix it in LinkedList.javathis is what i didLabProgra.pdfHow do I fix it in LinkedList.javathis is what i didLabProgra.pdf
How do I fix it in LinkedList.javathis is what i didLabProgra.pdf
mail931892
 
PROBLEM STATEMENTIn this assignment, you will complete DoubleEnde.pdf
PROBLEM STATEMENTIn this assignment, you will complete DoubleEnde.pdfPROBLEM STATEMENTIn this assignment, you will complete DoubleEnde.pdf
PROBLEM STATEMENTIn this assignment, you will complete DoubleEnde.pdf
climatecontrolsv
 
Here is the editable codeSolutionimport java.util.NoSuchEleme.pdf
Here is the editable codeSolutionimport java.util.NoSuchEleme.pdfHere is the editable codeSolutionimport java.util.NoSuchEleme.pdf
Here is the editable codeSolutionimport java.util.NoSuchEleme.pdf
arrowmobile
 
1 The goal is to implement DataStructuresArrayStack accor.pdf
1 The goal is to implement DataStructuresArrayStack accor.pdf1 The goal is to implement DataStructuresArrayStack accor.pdf
1 The goal is to implement DataStructuresArrayStack accor.pdf
saradashata
 

Similar to I need help in writing the test cases of the below methods i.pdf (20)

How do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdf
How do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdfHow do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdf
How do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdf
 
package algs13;import stdlib.;import java.util.Iterator;im.docx
package algs13;import  stdlib.;import java.util.Iterator;im.docxpackage algs13;import  stdlib.;import java.util.Iterator;im.docx
package algs13;import stdlib.;import java.util.Iterator;im.docx
 
Given below is the completed implementation of MyLinkedList class. O.pdf
Given below is the completed implementation of MyLinkedList class. O.pdfGiven below is the completed implementation of MyLinkedList class. O.pdf
Given below is the completed implementation of MyLinkedList class. O.pdf
 
Add functions push(int n- Deque &dq) and pop(Deque &dq)- Functions pus.docx
Add functions push(int n- Deque &dq) and pop(Deque &dq)- Functions pus.docxAdd functions push(int n- Deque &dq) and pop(Deque &dq)- Functions pus.docx
Add functions push(int n- Deque &dq) and pop(Deque &dq)- Functions pus.docx
 
Given the following ADT definition of a stack to use stack .docx
Given the following ADT definition of a stack to use stack .docxGiven the following ADT definition of a stack to use stack .docx
Given the following ADT definition of a stack to use stack .docx
 
Posfix
PosfixPosfix
Posfix
 
Hi, Please find my code.I have correted all of your classes.Plea.pdf
Hi, Please find my code.I have correted all of your classes.Plea.pdfHi, Please find my code.I have correted all of your classes.Plea.pdf
Hi, Please find my code.I have correted all of your classes.Plea.pdf
 
EmptyCollectionException-java -- - Represents the situation in which.docx
EmptyCollectionException-java --  - Represents the situation in which.docxEmptyCollectionException-java --  - Represents the situation in which.docx
EmptyCollectionException-java -- - Represents the situation in which.docx
 
public class DoubleArraySeq implements Cloneable {    Priva.pdf
public class DoubleArraySeq implements Cloneable {     Priva.pdfpublic class DoubleArraySeq implements Cloneable {     Priva.pdf
public class DoubleArraySeq implements Cloneable {    Priva.pdf
 
Please review my code (java)Someone helped me with it but i cannot.pdf
Please review my code (java)Someone helped me with it but i cannot.pdfPlease review my code (java)Someone helped me with it but i cannot.pdf
Please review my code (java)Someone helped me with it but i cannot.pdf
 
I have a stack in Java populated with integers. Im trying to compa.pdf
I have a stack in Java populated with integers. Im trying to compa.pdfI have a stack in Java populated with integers. Im trying to compa.pdf
I have a stack in Java populated with integers. Im trying to compa.pdf
 
AnswerNote Driver class is not given to test the DoubleArraySeq..pdf
AnswerNote Driver class is not given to test the DoubleArraySeq..pdfAnswerNote Driver class is not given to test the DoubleArraySeq..pdf
AnswerNote Driver class is not given to test the DoubleArraySeq..pdf
 
In java , I want you to implement a Data Structure known as a Doubly.pdf
In java , I want you to implement a Data Structure known as a Doubly.pdfIn java , I want you to implement a Data Structure known as a Doubly.pdf
In java , I want you to implement a Data Structure known as a Doubly.pdf
 
import java-util-Iterator- import java-util-NoSuchElementException- im.pdf
import java-util-Iterator- import java-util-NoSuchElementException- im.pdfimport java-util-Iterator- import java-util-NoSuchElementException- im.pdf
import java-util-Iterator- import java-util-NoSuchElementException- im.pdf
 
Hi,I have added the methods and main class as per your requirement.pdf
Hi,I have added the methods and main class as per your requirement.pdfHi,I have added the methods and main class as per your requirement.pdf
Hi,I have added the methods and main class as per your requirement.pdf
 
For the code below complete the preOrder() method so that it perform.pdf
For the code below complete the preOrder() method so that it perform.pdfFor the code below complete the preOrder() method so that it perform.pdf
For the code below complete the preOrder() method so that it perform.pdf
 
How do I fix it in LinkedList.javathis is what i didLabProgra.pdf
How do I fix it in LinkedList.javathis is what i didLabProgra.pdfHow do I fix it in LinkedList.javathis is what i didLabProgra.pdf
How do I fix it in LinkedList.javathis is what i didLabProgra.pdf
 
PROBLEM STATEMENTIn this assignment, you will complete DoubleEnde.pdf
PROBLEM STATEMENTIn this assignment, you will complete DoubleEnde.pdfPROBLEM STATEMENTIn this assignment, you will complete DoubleEnde.pdf
PROBLEM STATEMENTIn this assignment, you will complete DoubleEnde.pdf
 
Here is the editable codeSolutionimport java.util.NoSuchEleme.pdf
Here is the editable codeSolutionimport java.util.NoSuchEleme.pdfHere is the editable codeSolutionimport java.util.NoSuchEleme.pdf
Here is the editable codeSolutionimport java.util.NoSuchEleme.pdf
 
1 The goal is to implement DataStructuresArrayStack accor.pdf
1 The goal is to implement DataStructuresArrayStack accor.pdf1 The goal is to implement DataStructuresArrayStack accor.pdf
1 The goal is to implement DataStructuresArrayStack accor.pdf
 

More from adianantsolutions

Nancy acaba de vender algunas de sus acciones en Spotify Inc.pdf
Nancy acaba de vender algunas de sus acciones en Spotify Inc.pdfNancy acaba de vender algunas de sus acciones en Spotify Inc.pdf
Nancy acaba de vender algunas de sus acciones en Spotify Inc.pdf
adianantsolutions
 
Name this accessory gland to the digestive systemName th.pdf
Name this accessory gland to the digestive systemName th.pdfName this accessory gland to the digestive systemName th.pdf
Name this accessory gland to the digestive systemName th.pdf
adianantsolutions
 
Name of Bacteria Observation Results E coli Yellow s.pdf
Name of Bacteria    Observation    Results  E coli Yellow s.pdfName of Bacteria    Observation    Results  E coli Yellow s.pdf
Name of Bacteria Observation Results E coli Yellow s.pdf
adianantsolutions
 
Nasopharyngeal aspirates samples are used to investigate the.pdf
Nasopharyngeal aspirates samples are used to investigate the.pdfNasopharyngeal aspirates samples are used to investigate the.pdf
Nasopharyngeal aspirates samples are used to investigate the.pdf
adianantsolutions
 
Mutating His E7 the distal His in myoglobin to a Gly would.pdf
Mutating His E7 the distal His in myoglobin to a Gly would.pdfMutating His E7 the distal His in myoglobin to a Gly would.pdf
Mutating His E7 the distal His in myoglobin to a Gly would.pdf
adianantsolutions
 
Muthata1Calleingove LatinatLahr Nereant 1 17ar.pdf
Muthata1Calleingove LatinatLahr Nereant 1 17ar.pdfMuthata1Calleingove LatinatLahr Nereant 1 17ar.pdf
Muthata1Calleingove LatinatLahr Nereant 1 17ar.pdf
adianantsolutions
 
Nadine LeMieux has just inherited 8000 She wants to use t.pdf
Nadine LeMieux has just inherited 8000 She wants to use t.pdfNadine LeMieux has just inherited 8000 She wants to use t.pdf
Nadine LeMieux has just inherited 8000 She wants to use t.pdf
adianantsolutions
 
NAD Participa en la hidrlisis de la sacarosa a glucosa e.pdf
NAD  Participa en la hidrlisis de la sacarosa a glucosa  e.pdfNAD  Participa en la hidrlisis de la sacarosa a glucosa  e.pdf
NAD Participa en la hidrlisis de la sacarosa a glucosa e.pdf
adianantsolutions
 
Multi choice Which sequence represents the correct sequence .pdf
Multi choice Which sequence represents the correct sequence .pdfMulti choice Which sequence represents the correct sequence .pdf
Multi choice Which sequence represents the correct sequence .pdf
adianantsolutions
 
n2 1 let xPn Show that yv2x0X22n 2 Let x1x2.pdf
n2  1 let xPn Show that yv2x0X22n 2 Let x1x2.pdfn2  1 let xPn Show that yv2x0X22n 2 Let x1x2.pdf
n2 1 let xPn Show that yv2x0X22n 2 Let x1x2.pdf
adianantsolutions
 
n Faturalama Belgesi ilevini kullanmak iin n koullar nele.pdf
n Faturalama Belgesi ilevini kullanmak iin n koullar nele.pdfn Faturalama Belgesi ilevini kullanmak iin n koullar nele.pdf
n Faturalama Belgesi ilevini kullanmak iin n koullar nele.pdf
adianantsolutions
 
Myra had high scores as cooperative team player evenkeele.pdf
Myra had high scores as cooperative team player evenkeele.pdfMyra had high scores as cooperative team player evenkeele.pdf
Myra had high scores as cooperative team player evenkeele.pdf
adianantsolutions
 
Mycobacterium tuberculosis infecta a casi 13 de la poblaci.pdf
Mycobacterium tuberculosis infecta a casi 13 de la poblaci.pdfMycobacterium tuberculosis infecta a casi 13 de la poblaci.pdf
Mycobacterium tuberculosis infecta a casi 13 de la poblaci.pdf
adianantsolutions
 
My library gt IT 145 Intro to Software Development home .pdf
My library gt IT 145 Intro to Software Development home .pdfMy library gt IT 145 Intro to Software Development home .pdf
My library gt IT 145 Intro to Software Development home .pdf
adianantsolutions
 
My code is below How do I write this code without usin.pdf
My code is below How do I write this code without usin.pdfMy code is below How do I write this code without usin.pdf
My code is below How do I write this code without usin.pdf
adianantsolutions
 
My essay topic is Water Pollution in black Mississippi Jacks.pdf
My essay topic is Water Pollution in black Mississippi Jacks.pdfMy essay topic is Water Pollution in black Mississippi Jacks.pdf
My essay topic is Water Pollution in black Mississippi Jacks.pdf
adianantsolutions
 
Msrda renkli bir aleuron tohumun bir ksm bir maddenin var.pdf
Msrda renkli bir aleuron tohumun bir ksm bir maddenin var.pdfMsrda renkli bir aleuron tohumun bir ksm bir maddenin var.pdf
Msrda renkli bir aleuron tohumun bir ksm bir maddenin var.pdf
adianantsolutions
 
MRPnin baarl bir ekilde uygulanmas ve iletilmesi iin aadak.pdf
MRPnin baarl bir ekilde uygulanmas ve iletilmesi iin aadak.pdfMRPnin baarl bir ekilde uygulanmas ve iletilmesi iin aadak.pdf
MRPnin baarl bir ekilde uygulanmas ve iletilmesi iin aadak.pdf
adianantsolutions
 
Mr senabe is a senior teacher in a secondary school he has.pdf
Mr senabe is a senior teacher in a secondary school he has.pdfMr senabe is a senior teacher in a secondary school he has.pdf
Mr senabe is a senior teacher in a secondary school he has.pdf
adianantsolutions
 
Multiple Choice that those genes are not useful in interpret.pdf
Multiple Choice that those genes are not useful in interpret.pdfMultiple Choice that those genes are not useful in interpret.pdf
Multiple Choice that those genes are not useful in interpret.pdf
adianantsolutions
 

More from adianantsolutions (20)

Nancy acaba de vender algunas de sus acciones en Spotify Inc.pdf
Nancy acaba de vender algunas de sus acciones en Spotify Inc.pdfNancy acaba de vender algunas de sus acciones en Spotify Inc.pdf
Nancy acaba de vender algunas de sus acciones en Spotify Inc.pdf
 
Name this accessory gland to the digestive systemName th.pdf
Name this accessory gland to the digestive systemName th.pdfName this accessory gland to the digestive systemName th.pdf
Name this accessory gland to the digestive systemName th.pdf
 
Name of Bacteria Observation Results E coli Yellow s.pdf
Name of Bacteria    Observation    Results  E coli Yellow s.pdfName of Bacteria    Observation    Results  E coli Yellow s.pdf
Name of Bacteria Observation Results E coli Yellow s.pdf
 
Nasopharyngeal aspirates samples are used to investigate the.pdf
Nasopharyngeal aspirates samples are used to investigate the.pdfNasopharyngeal aspirates samples are used to investigate the.pdf
Nasopharyngeal aspirates samples are used to investigate the.pdf
 
Mutating His E7 the distal His in myoglobin to a Gly would.pdf
Mutating His E7 the distal His in myoglobin to a Gly would.pdfMutating His E7 the distal His in myoglobin to a Gly would.pdf
Mutating His E7 the distal His in myoglobin to a Gly would.pdf
 
Muthata1Calleingove LatinatLahr Nereant 1 17ar.pdf
Muthata1Calleingove LatinatLahr Nereant 1 17ar.pdfMuthata1Calleingove LatinatLahr Nereant 1 17ar.pdf
Muthata1Calleingove LatinatLahr Nereant 1 17ar.pdf
 
Nadine LeMieux has just inherited 8000 She wants to use t.pdf
Nadine LeMieux has just inherited 8000 She wants to use t.pdfNadine LeMieux has just inherited 8000 She wants to use t.pdf
Nadine LeMieux has just inherited 8000 She wants to use t.pdf
 
NAD Participa en la hidrlisis de la sacarosa a glucosa e.pdf
NAD  Participa en la hidrlisis de la sacarosa a glucosa  e.pdfNAD  Participa en la hidrlisis de la sacarosa a glucosa  e.pdf
NAD Participa en la hidrlisis de la sacarosa a glucosa e.pdf
 
Multi choice Which sequence represents the correct sequence .pdf
Multi choice Which sequence represents the correct sequence .pdfMulti choice Which sequence represents the correct sequence .pdf
Multi choice Which sequence represents the correct sequence .pdf
 
n2 1 let xPn Show that yv2x0X22n 2 Let x1x2.pdf
n2  1 let xPn Show that yv2x0X22n 2 Let x1x2.pdfn2  1 let xPn Show that yv2x0X22n 2 Let x1x2.pdf
n2 1 let xPn Show that yv2x0X22n 2 Let x1x2.pdf
 
n Faturalama Belgesi ilevini kullanmak iin n koullar nele.pdf
n Faturalama Belgesi ilevini kullanmak iin n koullar nele.pdfn Faturalama Belgesi ilevini kullanmak iin n koullar nele.pdf
n Faturalama Belgesi ilevini kullanmak iin n koullar nele.pdf
 
Myra had high scores as cooperative team player evenkeele.pdf
Myra had high scores as cooperative team player evenkeele.pdfMyra had high scores as cooperative team player evenkeele.pdf
Myra had high scores as cooperative team player evenkeele.pdf
 
Mycobacterium tuberculosis infecta a casi 13 de la poblaci.pdf
Mycobacterium tuberculosis infecta a casi 13 de la poblaci.pdfMycobacterium tuberculosis infecta a casi 13 de la poblaci.pdf
Mycobacterium tuberculosis infecta a casi 13 de la poblaci.pdf
 
My library gt IT 145 Intro to Software Development home .pdf
My library gt IT 145 Intro to Software Development home .pdfMy library gt IT 145 Intro to Software Development home .pdf
My library gt IT 145 Intro to Software Development home .pdf
 
My code is below How do I write this code without usin.pdf
My code is below How do I write this code without usin.pdfMy code is below How do I write this code without usin.pdf
My code is below How do I write this code without usin.pdf
 
My essay topic is Water Pollution in black Mississippi Jacks.pdf
My essay topic is Water Pollution in black Mississippi Jacks.pdfMy essay topic is Water Pollution in black Mississippi Jacks.pdf
My essay topic is Water Pollution in black Mississippi Jacks.pdf
 
Msrda renkli bir aleuron tohumun bir ksm bir maddenin var.pdf
Msrda renkli bir aleuron tohumun bir ksm bir maddenin var.pdfMsrda renkli bir aleuron tohumun bir ksm bir maddenin var.pdf
Msrda renkli bir aleuron tohumun bir ksm bir maddenin var.pdf
 
MRPnin baarl bir ekilde uygulanmas ve iletilmesi iin aadak.pdf
MRPnin baarl bir ekilde uygulanmas ve iletilmesi iin aadak.pdfMRPnin baarl bir ekilde uygulanmas ve iletilmesi iin aadak.pdf
MRPnin baarl bir ekilde uygulanmas ve iletilmesi iin aadak.pdf
 
Mr senabe is a senior teacher in a secondary school he has.pdf
Mr senabe is a senior teacher in a secondary school he has.pdfMr senabe is a senior teacher in a secondary school he has.pdf
Mr senabe is a senior teacher in a secondary school he has.pdf
 
Multiple Choice that those genes are not useful in interpret.pdf
Multiple Choice that those genes are not useful in interpret.pdfMultiple Choice that those genes are not useful in interpret.pdf
Multiple Choice that those genes are not useful in interpret.pdf
 

Recently uploaded

Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 

Recently uploaded (20)

Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 

I need help in writing the test cases of the below methods i.pdf

  • 1. I need help in writing the test cases of the below methods in java. The test cases must test both empty and non empty deque.PLS HELP ME WITH WRITING THE TEST CASES IN JAVA.ITS URGENT. package deque; /** * A deque implemented using a doubly-linked chain. * * @param <T> * The type of elements contained in the deque. */ public class Lab08Deque<T> extends DLinkedDeque<T> { /** * Inserts a new item at the front of the deque. * * @param newEntry * the item to insert. */ public void addToFront(T newEntry) { DLNode<T> newNode = new DLNode<T>(newEntry); if (isEmpty()) { lastNode = newNode; } else { firstNode.setPreviousNode(newNode); } newNode.setNextNode(firstNode); firstNode = newNode; size++; throw new UnsupportedOperationException( "You have not implemented addToFront() yet"); } /** * Insert a new item at the rear of the deque. * * @param newEntry * the item to insert. */ public void addToBack(T newEntry) { DLNode<T> newNode = new DLNode<T>(newEntry); if (isEmpty()) { firstNode = newNode; }
  • 2. else { lastNode.setPreviousNode(newNode); newNode.setPreviousNode(lastNode); } lastNode = newNode; size++; throw new UnsupportedOperationException( "You have not implemented addToBack() yet"); } /** * Remove the item at the front of the deque. * * @return The item that was removed * @throws EmptyQueueException * if there is not an element at the front */ public T removeFront() { if (isEmpty()) { throw new EmptyQueueException(); } T front = firstNode.getData(); firstNode = firstNode.getNextNode(); if (firstNode == null) { lastNode = null; } else { firstNode.setPreviousNode(null); } throw new UnsupportedOperationException( "You have not implemented removeFront() yet"); } /** * Remove the item at the rear of the deque. * * @return The item that was removed * @throws EmptyQueueException * if there is no element at the front */ public T removeBack() { if (isEmpty()) { throw new EmptyQueueException(); }
  • 3. T data = lastNode.getData(); lastNode = lastNode.getPreviousNode(); if (lastNode == null) { firstNode = null; } else { lastNode.setPreviousNode(null); } throw new UnsupportedOperationException( "You have not implemented removeBack() yet"); } /** * Get the item at the front (the head) of the deque. Does not alter the * deque. * * @return the item at the front of the deque. * @throws EmptyQueueException * if no element at the front */ public T getFront() { if (isEmpty()) { throw new EmptyQueueException(); } return firstNode.getData(); } /** * Get the item at the rear (the tail) of the deque. Does not alter the * deque. * * @return the item at the rear of the deque. * @throws EmptyQueueException * if no element at rear * */ public T getBack() { if (isEmpty()) { throw new EmptyQueueException(); } return lastNode.getData(); } /** * Check if the deque is empty
  • 4. * * @return true if the deque has no items */ public boolean isEmpty() { return size() == 0; } /** * Empty the deque. */ public void clear() { while (!isEmpty()) { removeFront(); } } // ---------------------------------------------------------- /** * Returns a string representation of this deque. A deque's string * representation is written as a comma-separated list of its contents (in * front-to-rear order) surrounded by square brackets, like this: * * [52, 14, 12, 119, 73, 80, 35] * * An empty deque is simply []. * * @return a string representation of the deque */ @Override public String toString() { StringBuilder s = new StringBuilder(); s.append("["); DLNode<T> p = firstNode; while (p != null) { if (s.length() > 1) { s.append(", "); } s.append(p.getData()); p = p.getNextNode(); } s.append("]"); return s.toString(); } }