### Question:
FindFirstGreaterEqualEleInOrderedArray { public int find(int[] nums, int target) { if (nums == null || nums.length == 0) { throw new IllegalArgumentException("input array can not be null or empty!"); } if (!isOrdered(nums)) { throw new IllegalArgumentException("input array must be ordered!"); } int last = nums[nums.length - 1]; if (target > last) { throw new IllegalArgumentException( "There is no value in the input array equal to or greater than target: " + target + "\n" + "The maximum element in array is " + last); } if (target == last) { return last; } if (target <= nums[0]) { return nums[0]; } int lo = 0; int hi = nums.length - 1; int targetIdx = 0; while (lo <= hi) { int mid = (hi - lo) / 2 + lo; if (target > nums[mid]) { lo = mid + 1; } else if (target > nums[mid - 1]) { targetIdx = mid; break; } else { hi = mid - 1; } } return nums[targetIdx]; }  static void main(String[] args); int find(int[] nums, int target);  }### Answer:
@Test public void testNullInput() { expectedEx.expect(IllegalArgumentException.class); expectedEx.expectMessage("null"); f.find(null, 0); }
@Test public void testEmptyInputArray() { expectedEx.expect(IllegalArgumentException.class); expectedEx.expectMessage("eee"); f.find(new int[]{}, 0); }
@Test public void testNormalInput() { int[] a = {1, 3, 3, 3, 3, 3, 3, 3, 3, 5, 7, 9}; int target = 8; int res = f.find(a, target); assertEquals(res, 10); }
@Test public void testTargetIntegerMinVal() { int[] a = {1, 3, 3, 3, 3, 3, 3, 3, 3, 5, 7, 9}; int res = f.find(a, Integer.MIN_VALUE); assertEquals(res, 1); }
@Test public void testInputUnOrderedArray() { expectedEx.expect(IllegalArgumentException.class); int[] a = {1, -1, 1, 1, 1, 1, 1}; f.find(a, -1); }