### Question:
ResourceReferenceCollector { public Collection<ResourceReference> getResourceReferences() { if( referencedResourcesMap != null ) { return referencedResourcesMap.values(); } return Collections.emptyList(); }  Collection<ResourceReference> getResourceReferences(); Collection<SharedPart> getSharedReferences(); Collection<Resource> getResources(); ResourceReference addResourceReference(String fullyQualifiedName, ResourceType type); void addResourceReferences(ResourceReferenceCollector collector); void addSharedReference(String partName, PartType partType); Resource addResource(String resourceFQN, ResourceType type);  }### Answer:
@Test public void checkAddResourceReference() { whenCollectorHasResourceReference( collector, "f.q.c.n", ResourceType.JAVA ); thenCollectorHasResourceReferences( collector, 1 ); thenResourceReferenceHasPartReferences( collector.getResourceReferences().stream().findFirst().get(), 0 ); }
@Test public void checkAddResourceReferences() { final TestResourceReferenceCollector siblingCollector = new TestResourceReferenceCollector(); whenCollectorHasResourceReference( collector, "f.q.c.n", ResourceType.JAVA ); whenCollectorHasResourceReference( siblingCollector, "f.q.c.n", ResourceType.JAVA ); whenCollectorHasSiblingCollectorsResourceReference( collector, siblingCollector ); thenCollectorHasResourceReferences( siblingCollector, 1 ); thenResourceReferenceHasPartReferences( siblingCollector.getResourceReferences().stream().findFirst().get(), 0 ); }