DirEntry implements Serializable { public String getShortenedFullEntryName() { return getShortenedFullEntryName(FULL_ENTRY_NAME_MAX_LENGTH); } DirEntry();  DirEntry(final String entryPath, final String name, final String author, final Date date, final Kind kind, long revision, long size); static DirList createDirectoryList(final List<DirEntry> entries, final Properties properties); String getId(); String getName(); CamelCasePattern getCamelCasePattern(); List<String> getNameFragments(); String getFullEntryName(); String getShortenedFullEntryName(); String getPath(); long getSize(); Kind getKind(); Date getDate(); long getRevision(); String getAuthor(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static final int FULL_ENTRY_NAME_MAX_LENGTH; }
@Test public void testGetShortenedFullEntryName() throws Exception { DirEntry entry; entry = toEntry("/source/com/bli/bla/blu/saaaaaoooooooooooaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/", "test.fil"); assertEquals("/source/com/bli/bla/blu/saaaaaoooooooooooaaaaaaaaaaaaaaaaa.../test.fil", entry.getShortenedFullEntryName()); assertEquals(DirEntry.FULL_ENTRY_NAME_MAX_LENGTH, entry.getShortenedFullEntryName().length()); entry = toEntry("/source/com/bli/bla/blu/saaaaa/bbbbbb/ccccccccc/dddddddd/aaaaaaaaaaaaaaaaaa/", "reallylongfilenamejustfortestingpurposes.fil"); assertEquals("/source/com/bli/bla/bl.../reallylongfilenamejustfortestingpurposes.fil", entry.getShortenedFullEntryName()); assertEquals(DirEntry.FULL_ENTRY_NAME_MAX_LENGTH, entry.getShortenedFullEntryName().length()); entry = toEntry("/source/com/bli/bla/blu/", "test.fil"); assertEquals("/source/com/bli/bla/blu/test.fil", entry.getShortenedFullEntryName()); entry = toEntry("/source/com/bli/bla/blu/", "thisisafilenamewithmorethanenoughcharactersinitreallynotperfectlookingontheweb.fil"); assertEquals(".../thisisafilenamewithmorethanenoughcharactersinitreallynotperfectlookingontheweb.fil", entry.getShortenedFullEntryName()); assertEquals(DirEntry.FULL_ENTRY_NAME_MAX_LENGTH + 16, entry.getShortenedFullEntryName().length()); entry = toEntry("/source/com/bli/bla/blu/saaaaa/bbbbbb/ccccccccc/dddddddd/aaaaaaaaaaaaaaaaaa/", "reallylongfilenamejustfortestingpurposesonly.fil"); assertEquals("/source/com/bli/bl.../reallylongfilenamejustfortestingpurposesonly.fil", entry.getShortenedFullEntryName()); assertEquals(DirEntry.FULL_ENTRY_NAME_MAX_LENGTH, entry.getShortenedFullEntryName().length()); final String path = "/abcde/fghijk/lmnopqrs/"; assertEquals("/abcde/fghijk/lmnopqrs/abc", toEntry(path, "abc").getShortenedFullEntryName(26)); assertEquals("/abcde/fghijk/lmno.../abc", toEntry(path, "abc").getShortenedFullEntryName(25)); assertEquals("/abcde/fghijk/lmn.../abc", toEntry(path, "abc").getShortenedFullEntryName(24)); assertEquals("/abcde/fghijk/lm.../abc", toEntry(path, "abc").getShortenedFullEntryName(23)); assertEquals("/abcde/fghijk/l.../abc", toEntry(path, "abc").getShortenedFullEntryName(22)); assertEquals("/abcde/fghijk/.../abc", toEntry(path, "abc").getShortenedFullEntryName(21)); assertEquals("/abcde/fghijk.../abc", toEntry(path, "abc").getShortenedFullEntryName(20)); assertEquals("/abcde/fghij.../abc", toEntry(path, "abc").getShortenedFullEntryName(19)); assertEquals("/abcde/fghi.../abc", toEntry(path, "abc").getShortenedFullEntryName(18)); assertEquals("/abcde/fgh.../abc", toEntry(path, "abc").getShortenedFullEntryName(17)); assertEquals("/abcde/fg.../abc", toEntry(path, "abc").getShortenedFullEntryName(16)); assertEquals("/abcde/f.../abc", toEntry(path, "abc").getShortenedFullEntryName(15)); assertEquals("/abcde/.../abc", toEntry(path, "abc").getShortenedFullEntryName(14)); assertEquals("/abcde.../abc", toEntry(path, "abc").getShortenedFullEntryName(13)); assertEquals("/abcd.../abc", toEntry(path, "abc").getShortenedFullEntryName(12)); assertEquals("/abc.../abc", toEntry(path, "abc").getShortenedFullEntryName(11)); assertEquals("/ab.../abc", toEntry(path, "abc").getShortenedFullEntryName(10)); assertEquals("/a.../abc", toEntry(path, "abc").getShortenedFullEntryName(9)); assertEquals("/.../abc", toEntry(path, "abc").getShortenedFullEntryName(8)); assertEquals(".../abc", toEntry(path, "abc").getShortenedFullEntryName(7)); assertEquals(".../abc", toEntry(path, "abc").getShortenedFullEntryName(0)); }