ThumbnailPhotoMapper extends BaseAttributeMapper<Map.Entry<String, byte[]>> { @Override public Map.Entry<String, byte[]> mapFromAttributes(Attributes attributes) throws NamingException { var id = getSingleAttributeValue(attributes, idAttribute, String.class); var thumbnailPhoto = getSingleAttributeValue(attributes, "thumbnailPhoto", byte[].class); return Map.entry(id, thumbnailPhoto); } ThumbnailPhotoMapper(String idAttribute); @Override Map.Entry<String, byte[]> mapFromAttributes(Attributes attributes);  }
@Test public void mapFromAttributes() throws NamingException { var expectedId = "user-id"; var expectedThumbnailPhoto = new byte[] {-2, 10, 39, 32}; var expectedEntry = Map.entry(expectedId, expectedThumbnailPhoto); var idAttr = new BasicAttribute(ID_ATTR_VALUE, expectedId); var thumbnailPhotoAttr = new BasicAttribute("thumbnailPhoto", expectedThumbnailPhoto); var attributes = new BasicAttributes(); attributes.put(idAttr); attributes.put(thumbnailPhotoAttr); var actualEntry = mapper.mapFromAttributes(attributes); assertThat(actualEntry).isEqualTo(expectedEntry); }