Util { public static String toString(final Object aObject) { if (aObject == null) { return "null"; } if (aObject.getClass().isArray()) { return new ToStringBuilder(aObject, LAB_STYLE).append(aObject).toString(); } else if (aObject instanceof Discriminable) { return toString(((Discriminable) aObject).getDiscriminatorValue()); } else { return String.valueOf(aObject); } }  static synchronized File getUrlAsFile(URL aUrl, boolean aCache); static File getStreamAsFile(final InputStream is); static void shove(final InputStream is, final OutputStream os); static void shoveAndClose(
			final InputStream is,
			final OutputStream os); static void close(final Closeable object); static void copy(File aIn, File aOut); static void copy(File aIn, File aOut, boolean aLink); static void copyFile(final File aIn, final File aOut); static String toString(final Object aObject); static T retrieveBinary(final File aFile, final T aConsumer); static boolean isWindows(); static boolean isMac(); static boolean isUnix(); static boolean isSymlinkSupported(); static void createSymbolicLink(File aSource, File aTarget); static String getComprehensiveMessage(Throwable aThrowable); static final ToStringStyle LAB_STYLE; }
@Test public void testToStringOnPrimitiveArray() { int[] data = new int[] { 0, 1, 2 }; assertEquals("[0, 1, 2]", Util.toString(data)); }
@Test public void testToStringOnClass() { Class<?> data = Util.class; assertEquals(Util.class.toString(), Util.toString(data)); }