Question: 5. Two approaches used to write the specifications for operations between a sender and a receiver object (e.g., Queue) are based on design by contract
5. Two approaches used to write the specifications for operations between a sender and a receiver object (e.g., Queue) are based on design by contract and defensive design. [35]
Briefly describe each of the two approaches to writing such a specification.
State how each approach affects the testing process and relate it to the Queue class where possible.
Draw a state machine specifying the operations for a Queue. Use a modeling tool, such as StarUML, to draw your state machine (statechart), copy and paste the state machine into this document.
Write test cases that satisfy the all states criteria for the Queue using the state machine. Assume the Queue stores Integer objects with a maximum size of 5 objects.
Write test cases that satisfy the all transitions criteria for the Queue using the state machine. Assume the Queue stores Integer objects with a maximum size of 5 objects.
Draw a subsume hierarchy for the all states and all transitions criteria. Which of these testing criteria is the best in your opinion and why?
Using an IDE (e.g., Eclipse) write well-documented code for the Queue class using the defensive design approach (QueueDD). Assume the Queue stores Integer objects with a maximum size of 5 objects. The Queue must be implemented using a LinkedList from the Java library. If you copy the code from the Internet or a textbook, please show the reference in the documentation.
Write two (2) well-documented JUnit test classes using the IDE for the test cases in parts (d) and (e). The names of the JUnit test classes should be QueueDD_AS_Tests and QueueDD_AT_Tests, respectively. Copy and paste the code for the Queue class (QueueDD) and its associated test classes (QueueDD_AS_Tests and QueueDD_AT_Tests) into this document.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
