Fix for ALF-20173 Alfresco TAGS Exceptions: java.lang.ArrayIndexOutOfBoundsException: 1

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@56190 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Andrew Hind
2013-10-01 10:04:44 +00:00
parent 4034089d18
commit 4ffade2d96
2 changed files with 44 additions and 3 deletions

View File

@@ -18,7 +18,9 @@
*/
package org.alfresco.repo.tagging;
import java.io.ByteArrayInputStream;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
@@ -2121,4 +2123,16 @@ public class TaggingServiceImplTest extends TestCase
}
});
}
public void testTagFileRead() throws UnsupportedEncodingException
{
List<TagDetails> tags = TaggingServiceImpl.readTagDetails(new ByteArrayInputStream("Tag1|10\nTag2|20\nInvalid\nInvalid2|\nInvalid3|One\nTooMany|1|2\n\n".getBytes("UTF-8")));
assertEquals(3, tags.size());
assertEquals(tags.get(0).getName(), "Tag1");
assertEquals(tags.get(1).getName(), "Tag2");
assertEquals(tags.get(2).getName(), "TooMany");
assertEquals(tags.get(0).getCount(), 10);
assertEquals(tags.get(1).getCount(), 20);
assertEquals(tags.get(2).getCount(), 1);
}
}