@Test public void testConstructSelfUri() { String id = UUID.randomUUID().toString(); URI self = InstanceResource.constructSelfUri(INSTANCE_URI_INFO, id); assertEquals(id, Strings.commonSuffix(id, self.getPath())); assertEquals( INSTANCE_URI_INFO.getAbsolutePath().toString(), Strings.commonPrefix(INSTANCE_URI_INFO.getAbsolutePath().toString(), self.toString())); }
/** * Returns the longest string {@code suffix} such that {@code a.toString().endsWith(suffix) && * b.toString().endsWith(suffix)}, taking care not to split surrogate pairs. If {@code a} and * {@code b} have no common suffix, returns the empty string. * * @since 11.0 * @see Strings#commonSuffix(CharSequence, CharSequence) */ @Beta public static String commonSuffix(final CharSequence a, final CharSequence b) { return Strings.commonSuffix(a, b); }