Input Space Partitioning
1. Answer questions (a) and (b) for the method findNode() below:
public Record findNode(Tree tree, String name)
/*
Effects: if tree or name are null, throw NullPointerException
else if node with specified name is in the tree, return Record for that node
else return null
*/
For example:
Tree tree1 has 3 nodes:
Parent node: name=Helen (record1)
Two children nodes: name=John (record2) and name=Helen (record3)
Call: findNode(tree1, "Helen") would return either record1 or record3
Call: findNode(tree1, null) would throw NullPointerException
Call: findNode(tree1, "Mike") would return null
Base your answer on the following characteristic partitioning:
Characteristic: Type of node with specified name in tree
Block 1: node is a parent node
Block 2: node is a child node
a. Does "Type of node with specified name in tree" fail disjointness property? Explain your answer. If it fails, give an example to illustrate this.
b. Does "Type of node with specified name in tree" fail completeness property? Explain your answer. If it fails, give an example to illustrate this.
2. Answer questions (a)-(c) for the method union() below:
public Set union(Set s1, Set s2)
/*
Effects: if s1 or s2 are null, throw NullPointerException
else return the non-null Set that is the result of union of both sets
*/
For example:
s1 = {1,2,3}
s2 = {1,4,5}
Call: union(s1,s2) returns set {1,2,3,4,5}
a. Identify at least three characteristics that suggest partitions
b. Identify the blocks in the partition for each characteristic
c. Define values for the blocks