### Question:
ItemConfiguration { public ItemId getItemId(final Item item) { final Method readMethod = properties.get(primaryKeyDefinition.propertyName()).getReadMethod(); try { final Object itemIdValueObj = readMethod.invoke(item); final String itemIdValue = itemIdValueObj == null ? null : String.valueOf(itemIdValueObj); if (CompoundPrimaryKeyDefinition.class.isAssignableFrom(primaryKeyDefinition.getClass())) { final CompoundPrimaryKeyDefinition compoundPrimaryKeyDefinition = (CompoundPrimaryKeyDefinition) primaryKeyDefinition; final Method supportingReadMethod = properties .get(compoundPrimaryKeyDefinition.supportingPropertyName()).getReadMethod(); final Object itemIdSupportingValueObj = supportingReadMethod.invoke(item); final String itemIdSupportingValue = itemIdSupportingValueObj == null ? null : String.valueOf(itemIdSupportingValueObj); return new ItemId(itemIdValue, itemIdSupportingValue); } return new ItemId(itemIdValue); } catch (final InvocationTargetException | IllegalAccessException | IllegalArgumentException e) { throw new IllegalStateException(e); } } ItemConfiguration(final Class<? extends Item> itemClass, final String tableName);  ItemConfiguration(final Class<? extends Item> itemClass, final String tableName,
            final PrimaryKeyDefinition primaryKeyDefinition); void registerIndexes(final Collection<IndexDefinition> indexDefinitions); void registerUniqueConstraints(final Collection<UniqueConstraint> uniqueConstraints); boolean hasIndexOn(final String propertyName); ItemId getItemId(final Item item); Class<? extends Item> itemClass(); String tableName(); PrimaryKeyDefinition primaryKeyDefinition(); Collection<PropertyDescriptor> propertyDescriptors(); Collection<IndexDefinition> indexDefinitions(); Collection<UniqueConstraint> uniqueConstraints(); boolean hasIndexForQuery(final AttributeQuery attributeQuery); PropertyDescriptor getPropertyDescriptor(final String propertyName); String indexNameForQuery(final AttributeQuery attributeQuery);  }### Answer:
@Test public void shouldReturnItemId_fromItemConfiguration() { final ItemConfiguration itemConfiguration = new ItemConfiguration(StubItem.class, randomString(10)); final StubItem stubItem = new StubItem(); final String stubItemId = randomId(); stubItem.setId(stubItemId); final ItemId itemId = itemConfiguration.getItemId(stubItem); assertEquals(stubItemId, itemId.value()); }