ObjectPropertyCollectionDescriptor extends FieldDescriptor { @Override public URI getAttributeContext(FieldSpecification<?, ?> attribute) { Objects.requireNonNull(attribute); if (getField().equals(attribute.getJavaField())) { return getContext(); } return elementDescriptor.getAttributeContext(attribute); } ObjectPropertyCollectionDescriptor(Field attribute);  ObjectPropertyCollectionDescriptor(URI context, Field attribute);  ObjectPropertyCollectionDescriptor(URI context, Field attribute, boolean assertionsInSubjectContext); @Override Descriptor getAttributeDescriptor(FieldSpecification<?, ?> attribute); @Override URI getAttributeContext(FieldSpecification<?, ?> attribute); @Override ObjectPropertyCollectionDescriptor addAttributeDescriptor(Field attribute, Descriptor descriptor); @Override ObjectPropertyCollectionDescriptor addAttributeContext(Field attribute, URI context); EntityDescriptor getElementDescriptor(); @Override int hashCode(); @Override boolean equals(Object obj);  }
@Test void getAttributeContextRetrievesAttributeContextFromElementDescriptor() throws Exception { final URI context = URI.create("http: final FieldSpecification fs = mock(FieldSpecification.class); when(fs.getJavaField()).thenReturn(TestClass.stringAttField()); final ObjectPropertyCollectionDescriptor descriptor = new ObjectPropertyCollectionDescriptor(context, WithReference.class.getDeclaredField("testClass")); assertEquals(context, descriptor.getAttributeContext(fs)); }