@Test public void whenInputIsRawUUIDShouldReturnValidUUID() { String uuid = StringUtils.convertToUUIDString("28A8836D5642534BB46B34F87E078729"); assertThat(uuid, is("28A8836D-5642-534B-B46B-34F87E078729")); }
public static String convertToUUIDString(String value) { if (value == null || value.contains("-") || value.length() != 32) { return value; } StringBuilder sb = new StringBuilder(value); char dash = '-'; sb.insert(8, dash); sb.insert(13, dash); sb.insert(18, dash); sb.insert(23, dash); return sb.toString(); }
StringUtils { public static String convertToUUIDString(String value) { if (value == null || value.contains("-") || value.length() != 32) { return value; } StringBuilder sb = new StringBuilder(value); char dash = '-'; sb.insert(8, dash); sb.insert(13, dash); sb.insert(18, dash); sb.insert(23, dash); return sb.toString(); } }
StringUtils { public static String convertToUUIDString(String value) { if (value == null || value.contains("-") || value.length() != 32) { return value; } StringBuilder sb = new StringBuilder(value); char dash = '-'; sb.insert(8, dash); sb.insert(13, dash); sb.insert(18, dash); sb.insert(23, dash); return sb.toString(); } private  StringUtils(); }
StringUtils { public static String convertToUUIDString(String value) { if (value == null || value.contains("-") || value.length() != 32) { return value; } StringBuilder sb = new StringBuilder(value); char dash = '-'; sb.insert(8, dash); sb.insert(13, dash); sb.insert(18, dash); sb.insert(23, dash); return sb.toString(); } private  StringUtils(); static String join(List<String> list, String separator); static String convertToUUIDString(String value); }
StringUtils { public static String convertToUUIDString(String value) { if (value == null || value.contains("-") || value.length() != 32) { return value; } StringBuilder sb = new StringBuilder(value); char dash = '-'; sb.insert(8, dash); sb.insert(13, dash); sb.insert(18, dash); sb.insert(23, dash); return sb.toString(); } private  StringUtils(); static String join(List<String> list, String separator); static String convertToUUIDString(String value);  }