### Question:
LocationUtil { public static LatLng parseLatLng(String latitude, String longitude) throws InvalidLocationException { LatLng point = null; try { double lat = Double.parseDouble(latitude); double lng = Double.parseDouble(longitude); if (!isValidLatitude(lat)) { throw new InvalidLocationException("range of latitude [" + latitude + "] not valid"); } else if (!isValidLongitude(lng)) { throw new InvalidLocationException("range of longitude [" + longitude + "] not valid"); } if (isValidLatitude(lat) && isValidLongitude(lng)) { point = new LatLng(lat, lng); } } catch (NumberFormatException ex) { throw new InvalidLocationException("invalid (latitude, longitude) = (" + latitude + "," + longitude + ")", ex); } return point; }  static Double parseDegrees(String latString); static boolean isValidLongitude(Double longitude); static boolean isValidLatitude(Double latitude); static LatLng parseLatLng(String latitude, String longitude);  }### Answer:
@Test(expected = InvalidLocationException.class) public void parseLngLatInvalid() throws InvalidLocationException { LocationUtil.parseLatLng("123.0", "123.0"); }
@Test(expected = InvalidLocationException.class) public void parseLngLatInvalid2() throws InvalidLocationException { LocationUtil.parseLatLng("", "123.0"); }
@Test public void parseLngLat() throws InvalidLocationException { LatLng actual = LocationUtil.parseLatLng("12.0", "13.0"); assertThat(actual.getLat(), is(12.0)); assertThat(actual.getLng(), is(13.0)); }
@Test public void parseValidLngLat() throws InvalidLocationException { LatLng actual = LocationUtil.parseLatLng("12.0", "-120.0"); assertThat(actual.getLat(), is(12.0)); assertThat(actual.getLng(), is(-120.0)); }