Util { public static Object convert(Class<?> type, String value) { if (type == Integer.class) { return Integer.parseInt(value.trim()); } else if (type == Long.class) { return Long.parseLong(value.trim()); } else if (type == String.class) { return value; } else { throw new RuntimeException("unexpected type: " + type); } }  static List<T> append(List<T> list, T ... elements); static List<Column<?>> cols(Column<?> ... elements); static Set<T> set(T ... elements); static Set<T> union(Collection<T> ... sets); static int compare(Collection<T> a,
                            Collection<T> b); static String toString(T[] array, int offset, int length); static String toString(Revision base, Revision fork); static Object convert(Class<?> type,
                                String value);  }
@Test public void simpleLong() { Object output = Util.convert(Long.class, input); long result = (Long) output; assertEquals(value, result); }
@Test public void longWithLeadingWhitespace() { String in = " " + input; Object output = Util.convert(Long.class, in); long result = (Long) output; assertEquals(value, result); }
@Test public void longWithTrailingWhitespace() { String in = input + " "; Object output = Util.convert(Long.class, in); long result = (Long) output; assertEquals(value, result); }
@Test public void longWithPadding() { String in = " " + input + " "; Object output = Util.convert(Long.class, in); long result = (Long) output; assertEquals(value, result); }
@Test public void simpleInt() { Assume.assumeTrue(value <= Integer.MAX_VALUE); Assume.assumeTrue(value >= Integer.MIN_VALUE); Object output = Util.convert(Integer.class, input); int result = (Integer) output; assertEquals(value, result); }