### Question:
VfsResourceReferenceSerializer extends AbstractVfsResourceReferenceSerializer { @Override public ExtendedURL serialize(VfsResourceReference resourceReference) throws SerializeResourceReferenceException, UnsupportedResourceReferenceException { ExtendedURL extendedURL; String scheme = resourceReference.getScheme(); try { ResourceReferenceSerializer<VfsResourceReference, ExtendedURL> schemeSpecificSerializer = this.componentManagerProvider.get().getInstance(TYPE, scheme); extendedURL = schemeSpecificSerializer.serialize(resourceReference); } catch (ComponentLookupException e) { extendedURL = super.serialize(resourceReference); } return extendedURL; }  @Override ExtendedURL serialize(VfsResourceReference resourceReference);  }### Answer:
@Test public void serializeWhenNoSpecificSchemeSerializer() throws Exception { VfsResourceReference reference = new VfsResourceReference( URI.create("somescheme:wiki:space.page@attachment"), "path1/path2/test.txt"); ExtendedURL extendedURL = new ExtendedURL(Arrays.asList( "vfs", "somescheme:wiki:space.page@attachment", "path1", "path2", "test.txt")); when(this.urlNormalizer.normalize(extendedURL)).thenReturn(extendedURL); assertEquals("/vfs/somescheme%3Awiki%3Aspace.page%40attachment/path1/path2/test.txt", this.vfsResourceReferenceSerializer.serialize(reference).toString()); }
@Test public void serializeWhenSpecificSchemeSerializer() throws Exception { VfsResourceReference reference = new VfsResourceReference( URI.create("attach:attachment"), "path1/path2/test.txt"); ExtendedURL extendedURL = new ExtendedURL(Arrays.asList( "vfs", "attach:wiki:space.page@attachment", "path1", "path2", "test.txt")); when(serializer.serialize(reference)).thenReturn(extendedURL); assertEquals("/vfs/attach%3Awiki%3Aspace.page%40attachment/path1/path2/test.txt", this.vfsResourceReferenceSerializer.serialize(reference).toString()); }