### Question:
CompoundAttributeQuery extends AttributeQuery { public <T extends Item> Class<?> getSupportingAttributeType(final Class<T> itemClass) { return getAttributeType(supportingAttributeName, itemClass); } CompoundAttributeQuery(final String attributeName, final Condition condition,
            final String supportingAttributeName, final Condition supportingCondition); String getSupportingAttributeName(); Condition getSupportingCondition(); Class<?> getSupportingAttributeType(final Class<T> itemClass); @Override String toString(); @Override int hashCode(); @Override boolean equals(final Object obj);  }### Answer:
@Test public void shouldGetSupportingAttributeType_withItemClass() { final String attributeName = randomString(10); final Condition mockCondition = mock(Condition.class); final String supportingAttributeName = "id"; final Condition mockSupportingCondition = mock(Condition.class); final CompoundAttributeQuery compoundAttributeQuery = new CompoundAttributeQuery(attributeName, mockCondition, supportingAttributeName, mockSupportingCondition); final Class<?> attributeType = compoundAttributeQuery.getSupportingAttributeType(StubItem.class); assertEquals(String.class, attributeType); }
@Test public void shouldNotGetSupportingAttributeType_withAttributeNotInItemClass() { final String attributeName = randomString(10); final Condition mockCondition = mock(Condition.class); final String supportingAttributeName = randomString(10); final Condition mockSupportingCondition = mock(Condition.class); final CompoundAttributeQuery compoundAttributeQuery = new CompoundAttributeQuery(attributeName, mockCondition, supportingAttributeName, mockSupportingCondition); NonExistentAttributeException expectedException = null; try { compoundAttributeQuery.getSupportingAttributeType(StubItem.class); } catch (final NonExistentAttributeException e) { expectedException = e; } assertNotNull(expectedException); assertTrue(expectedException.getMessage().contains(attributeName)); assertTrue(expectedException.getMessage().contains(StubItem.class.getCanonicalName())); }