Question
Three methods are described below. For each of them, you should write a stub implementation and then a set of JUnit tests. You should include
Three methods are described below. For each of them, you should write a stub implementation and then a set of JUnit tests. You should include tests for boundary/edge cases, base cases, and error cases. Your tests should have appropriately descriptive names. Your score will be determined by the completeness and quality of the test cases you write. You should not write an actual functioning implementation of any of the methods. Each method should be placed in its own class with each class in a separate .java file. Each method likewise should have a separate class that contains it tests and each of those methods should be in a separate file.
Searching an array (3 points)
public static int searchArray(Object obj, Object[] array)
This method searches an array (array) for a particular object (obj) and returns the index of the first occurrence of that object.
Removing elements from an array (4 points)
public static Object[] removeFromArray(Object object, Object[] array)
This method returns an array that is a copy of array but with all occurrences of object removed from it. That is, if array has 6 elements, two of which are object, then the returned array will contain have a length of 4.
Converting Unicode codepoint form UTF-32 to UTF-8 (6 points):
public static short[] encodeCodepointAsUtf8(int codepoint)
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