@@ -0,0 +1,1950 @@
+package de.slackspace.openkeepass.enricher;%0A%0Aimport de.slackspace.openkeepass.domain.*;%0Aimport de.slackspace.openkeepass.domain.enricher.IconEnricher;%0Aimport org.junit.Assert;%0Aimport org.junit.Test;%0A%0Aimport javax.xml.bind.DatatypeConverter;%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0Aimport java.util.UUID;%0A%0Apublic class IconEnricherTest %7B%0A%0A%09@Test%0A%09public void shouldAddIconDataAndMaintainIconUuid() %7B%0A%09%09UUID iconUuid = UUID.randomUUID();%0A%09%09byte%5B%5D transparentPng = DatatypeConverter.parseBase64Binary(%0A%09%09%09%22iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=%22%0A%09%09);%0A%0A%09%09CustomIcon customIcon = new CustomIconBuilder().uuid(iconUuid).data(transparentPng).build();%0A%0A%09%09List%3CCustomIcon%3E customIconList = new ArrayList%3CCustomIcon%3E();%0A%09%09customIconList.add(customIcon);%0A%0A%09%09CustomIcons customIcons = new CustomIconsBuilder().customIcons(customIconList).build();%0A%0A%09%09Meta meta = new MetaBuilder(%22iconTest%22).customIcons(customIcons).build();%0A%0A%09%09Entry entry1 = new EntryBuilder(%221%22).customIconUuid(iconUuid).build();%0A%0A%09%09Group groupA = new GroupBuilder(%22A%22).customIconUuid(iconUuid).addEntry(entry1).build();%0A%0A%09%09KeePassFile keePassFile = new KeePassFileBuilder(meta).addTopGroups(groupA).build();%0A%09%09IconEnricher enricher = new IconEnricher();%0A%09%09KeePassFile enrichedKeePassFile = enricher.enrichNodesWithIconData(keePassFile);%0A%0A%09%09Assert.assertEquals(%22group UUID doesn't match%22, iconUuid, enrichedKeePassFile.getRoot().getGroups().get(0).getCustomIconUuid());%0A%09%09Assert.assertArrayEquals(%22group icon data doesn't match%22, transparentPng, enrichedKeePassFile.getRoot().getGroups().get(0).getIconData());%0A%0A%09%09Assert.assertEquals(%22entry UUID doesn't match%22, iconUuid, enrichedKeePassFile.getRoot().getGroups().get(0).getEntries().get(0).getCustomIconUuid());%0A%09%09Assert.assertArrayEquals(%22entry icon data doesn't match%22, transparentPng, enrichedKeePassFile.getRoot().getGroups().get(0).getEntries().get(0).getIconData());%0A%09%7D%0A%7D%0A

add custom icon builder test