deque. Write one or more tests for [isEmpty and [size]. Run them and verify that they fail. Your test(s) shou verify more than one interesting case, such as checking both an empty and a nonempty list, or chec that the size changes. For thos
deque. Write one or more tests for [isEmpty and [size]. Run them and verify that they fail. Your test(s) shou verify more than one interesting case, such as checking both an empty and a nonempty list, or chec that the size changes. For thos
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
Write tests and implementation for size and is empty
Expert Solution
Step 1
- Import two packages 'org.junit.Assert' and 'org.junit.jupiter.api.Test' where 'org.junit.Assert' is static.
- Declare a class named 'Deque_test'
- Declare five methods in the class- testIsEmpty(),testIsEmpty_One(),testIsEmpty_Three(),testSizeZero(),testSizeTwo(),testSizeMultipe()
- Use @Test to annotate these methods as test methods or test cases which can be used for testing.
- Method testIsEmpty() contains a declaration of empty deque data structure and method assertFalse(deque.isEmpty()) is used to check if deque.isEmpty() function to return false.
- Method testIsEmpty_One() contains a declaration of empty deque data structure. An element '1' is added to the deque using the addLast() method in the deque. It also contains a method assertTrue(deque.isEmpty()) is used to check if deque.isEmpty() function to return true.
- Method testIsEmpty_Three() contains a declaration of empty deque data structure named 'deque' of integer type. Three elements 1,2,13 are added to the deque using the addLast() method in the deque. It also contains a method assertTrue(deque.isEmpty()) is used to check if deque.isEmpty() function to return true.
- Method testSizeZero() contains a declaration of empty deque data structure named 'deque' of integer type. And a method assertFalse(deque.size() == 0) which is used to check if deque.size() == 0 value returns false.
- Method testSizeTwo() contains a declaration of empty deque data structure named 'deque' of integer type. Two elements 1,2 are added to the deque using the addLast() method in the deque. And a method assertFalse(deque.size() == 2) which is used to check if deque.size() == 2 value returns false.
- Method testSizeMultiple() contains a declaration of empty deque data structure named 'deque' of integer type. Three elements 1,2,3 are added to the deque using the addLast() method in the deque. And a method assertFalse(deque.size() == 3) which is used to check if deque.size() == 3 value returns false.
Step by step
Solved in 4 steps with 3 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education