PathParamHelper { public static Long toLong(String value) { try { return Long.valueOf(value); } catch (NumberFormatException e) { throw new BadRequestException("failed to parse long, value=" + value, "INVALID_HTTP_REQUEST", e); } }  static T toEnum(String value, Class<T> valueClass); static Long toLong(String value); static Integer toInt(String value); static String toString(String value); static String toString(Number value); static String toString(T enumValue);  }
@Test void parseLong() { assertThat(PathParamHelper.toLong("100")).isEqualTo(100); assertThatThrownBy(() -> PathParamHelper.toLong("X")) .isInstanceOf(BadRequestException.class) .hasMessageContaining("failed to parse long"); }