Util { @SuppressWarnings("checkstyle:magicnumber") public static long idFromString(String str) { if (str == null || !ID_PATTERN.matcher(str).matches()) { return -1; } str = str.replaceAll("-", ""); return Long.parseUnsignedLong(str, 16); } private  Util(); static Entry<K, V> entry(K k, V v); static PredicateEx<EventJournalMapEvent<K, V>> mapPutEvents(); static PredicateEx<EventJournalCacheEvent<K, V>> cachePutEvents(); static FunctionEx<EventJournalMapEvent<K, V>, Entry<K, V>> mapEventToEntry(); static FunctionEx<EventJournalMapEvent<K, V>, V> mapEventNewValue(); static FunctionEx<EventJournalCacheEvent<K, V>, Entry<K, V>> cacheEventToEntry(); static FunctionEx<EventJournalCacheEvent<K, V>, V> cacheEventNewValue(); @SuppressWarnings("checkstyle:magicnumber") static String idToString(long id); @SuppressWarnings("checkstyle:magicnumber") static long idFromString(String str); static Path getFilePathOfClasspathResource(String resourcePath);  }
@Test public void when_idFromString() { assertEquals(0, idFromString("0000-0000-0000-0000")); assertEquals(1, idFromString("0000-0000-0000-0001")); assertEquals(Long.MAX_VALUE, idFromString("7fff-ffff-ffff-ffff")); assertEquals(Long.MIN_VALUE, idFromString("8000-0000-0000-0000")); assertEquals(-1, idFromString("ffff-ffff-ffff-ffff")); assertEquals(1234567890123456789L, idFromString("1122-10f4-7de9-8115")); assertEquals(-1234567890123456789L, idFromString("eedd-ef0b-8216-7eeb")); }