Misc { public static String createRandomUUID(boolean removeDashes) { String uuidString = java.util.UUID.randomUUID().toString(); if (removeDashes) { return uuidString.replaceAll("-", ""); } else { return uuidString; } }  static String createSimpleUUID(); static String createUUID(); static String createRandomUUID(boolean removeDashes); static String createRandomUUID(); static String asHex(byte[] buf); static String createNumericUUID(); static int unsignedByteToInt(byte b); static synchronized long getCurrentTimeMillis(); static void fileToWriter(String filename, Writer writer); static void fileToStream(String filename, OutputStream output); static void streamToStream(InputStream input, OutputStream output); static void streamToStream(InputStream input, OutputStream output, boolean closeInput); static void streamToFile(InputStream inputStream, File file); static byte[] streamToBytes(InputStream inputStream); static void readerToWriter(Reader reader, Writer writer); static void readerToWriter(Reader reader, Writer writer, boolean closeInput); static String fileToString(String fileName); static String fileToString(String fileName, String endOfLineString); static String fileToString(String fileName, String endOfLineString, boolean xmlEncode); static String readerToString(Reader reader, String endOfLineString, boolean xmlEncode); static String streamToString(InputStream stream); static String streamToString(InputStream stream, String streamEncoding); static String streamToString(InputStream stream, String endOfLineString, boolean xmlEncode); static String streamToString(InputStream stream, String endOfLineString, String streamEncoding, boolean xmlEncode); static String resourceToString(URL resource, String endOfLineString, boolean xmlEncode); static String resourceToString(URL resource); static String resourceToString(URL resource, String endOfLineString); static void stringToFile(String string, String fileName); static String replace(String source, String from, String to); static String concatStrings(String part1, String separator, String part2); static String hide(String string); static String hide(String string, int mode); static String byteArrayToString(byte[] input, String endOfLineString, boolean xmlEncode); static byte[] gzip(String input); static byte[] gzip(byte[] input); static String gunzipToString(byte[] input); static byte[] gunzip(byte[] input); static byte[] compress(String input); static byte[] compress(byte[] input); static String decompressToString(byte[] input); static byte[] decompress(byte[] input); static Properties getEnvironmentVariables(); static String getHostname(); static void copyContext(String keys, Map<String,Object> from, Map<String,Object> to); static String getDeployedApplicationBindings(); static String getApplicationDeploymentDescriptorPath(); static String getApplicationDeploymentDescriptor(); static String getConfigurationResources(); static String getConfigurationServer(); static String getConnectionPoolProperties(String confResString,
	                                                 String providerType, String jndiName); static String getJmsDestinations(String confResString); static long toFileSize(String value, long defaultValue); static String toFileSize(long value); static String toFileSize(long value, boolean format); static String toFileSize(long value, boolean format, boolean floor); static synchronized long getMessageSizeWarnByDefault(); static synchronized long getResponseBodySizeWarnByDefault(); static synchronized boolean isForceFixedForwardingByDefault(); static String listToString(List list); static void addItemsToList(Collection<String> collection, String list, String collectionDescription, boolean lowercase); static String getFileSystemTotalSpace(); static String getFileSystemFreeSpace(); static String getTotalTransactionLifetimeTimeout(); static String getTotalTransactionLifetimeTimeout(String configServerXml); static String getMaximumTransactionTimeout(); static String getMaximumTransactionTimeout(String configServerXml); static String getSystemTransactionTimeout(); static String getAge(long value); static String getDurationInMs(long value); static long parseAge(String value, long defaultValue); static String cleanseMessage(String inputString, String regexForHiding, String hideMethod); static String hideFirstHalf(String inputString, String regex); static String hideAll(String message, Collection<String> collection); static String hideAll(String message, Collection<String> collection, int mode); static String hideAll(String inputString, String regex); static String hideAll(String inputString, String regex, int mode); static String getBuildOutputDirectory(); static String getProjectBaseDir(); static String toSortName(String name); static int countRegex(String string, String regex); static final int BUFFERSIZE; static final String DEFAULT_INPUT_STREAM_ENCODING; static final String MESSAGE_SIZE_WARN_BY_DEFAULT_KEY; static final String RESPONSE_BODY_SIZE_WARN_BY_DEFAULT_KEY; static final String FORCE_FIXED_FORWARDING_BY_DEFAULT_KEY; }
@Test public void testCreateRandomUUIDRemoveDashes() throws Exception { String uuid = Misc.createRandomUUID(true); assertNotEquals(uuid.substring(8, 9), "-"); assertEquals(32, uuid.length()); }
@Test public void testCreateRandomUUID() throws Exception { String uuid = Misc.createRandomUUID(); assertFalse(uuid.isEmpty()); }