Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The java.util.BitSet is an class that is part of Javas standard library that enables its users to work with bitvalues. The class has numerous methods,
The java.util.BitSet is an class that is part of Javas standard library that enables its users to work with
bitvalues. The class has numerous methods, but, for this assignment, please only consider only the following
four:
public BitSet(int nbits)
//Creates a bit set whose initial size is large enough to explicitly
//represent bits with indices in the range 0 through nbits-1. All bits are initially false.
//Parameters: nbits - the initial size of the bit set
//Throws: NegativeArraySizeException - if the specified initial size is negative
public void set(int bitIndex)
//Sets the bit at the specified index to true.
//Parameters: bitIndex - a bit index
//Throws: IndexOutOfBoundsException - if the specified index is negative
public boolean get(int bitIndex)
//Returns the value of the bit with the specified index. The value
//is true if the bit with the index bitIndex is
//currently set in this BitSet; otherwise, the result is false.
//Parameters: bitIndex - the bit index
//Returns: the value of the bit with the specified index
//Throws: IndexOutOfBoundsException - if the specified index is negative
public void flip(int bitIndex)
//Sets the bit at the specified index to the complement of its current value.
//Parameters: bitIndex - the index of the bit to flip
//Throws: IndexOutOfBoundsException - if the specified index is negative
Complete the following tasks for testing the capabilities of the four methods of the BitSet class using input
space partitioning. Assume that Java11 is being used.
1. Devise a set of characteristics based on the functionality described in the four methods of the BitSet
class. Aim for at least one interface-based and one functionality-based characterstic. Document the
characteristics and their corresponding blocks in a table. Make sure that each of the blocks is disjoint
and that they together cover the entire input domain.
2. Devise a set of test requirements based on the characteristics (blocks) from above, using Base Choice
Coverage, documenting the base case and any unfeasible combinations. Again clearly specify all of the
requirements in a table.
3. Implement a set of tests that cover all of the feasible test requirements. Add a comment to the top of
each test that indicates the test requirement(s) that are covered.
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