@Test
public void testSerializeAttachmentReference() throws Exception
{

    EntityReference reference = resolver.resolve("wiki:space.page@filename", EntityType.ATTACHMENT);
    Assert.assertEquals("wiki:space.page@filename", serializer.serialize(reference));
    reference = resolver.resolve("", EntityType.ATTACHMENT);
    Assert.assertEquals("xwiki:XWiki.WebHome@filename", serializer.serialize(reference));
    reference = resolver.resolve("wiki:space.page@my.png", EntityType.ATTACHMENT);
    Assert.assertEquals("wiki:space.page@my.png", serializer.serialize(reference));
    reference = resolver.resolve("some:file.name", EntityType.ATTACHMENT);
    Assert.assertEquals("xwiki:XWiki.WebHome@some:file.name", serializer.serialize(reference));
    // Test escapes
    reference = resolver.resolve(":.\\@", EntityType.ATTACHMENT);
    Assert.assertEquals("xwiki:XWiki.WebHome@:.\\@", serializer.serialize(reference));
}