### Question:
InteractionUnit implements Consumer, Producer { public <T extends Mapping> T findMapping(MappingType type) { return this.findMapping(type, null); } protected  InteractionUnit(QName id, final String label); protected  InteractionUnit(final QName id, final String label, S stereotype); S getStereotype(); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString(); void addMapping(Mapping mapping); boolean hasMapping(MappingType type); T findMapping(MappingType type); T findMapping(MappingType type, Predicate<T> predicate); @Override Set<Resource<ResourceType>> getInputs(); @Override boolean doesConsume(Resource<ResourceType> event); void accept(InteractionUnitVisitor visitor); InteractionUnit getParent(); boolean hasParent(); QName getId(); String getLabel(); void setLabel(final String label); @Override boolean doesConsume(); @Override boolean doesProduce(); boolean doesProduce(Resource<ResourceType> resource); @Override void setOutputs(Resource<ResourceType>... resource); @Override void setInputs(Resource<ResourceType>... resource); Set<Resource<ResourceType>> getOutputs();  }### Answer:
@Test public void findMapping() { Container basicAttributes = new Container(NAMESPACE, "basicAttributes", "Basic Attributes"); InteractionUnit root = new Builder() .start(new Container(NAMESPACE, "root", "Root", OrderIndependance)) .mappedBy(new DMRMapping().setAddress("root")) .add(new Select(NAMESPACE, "table", "Table")) .start(new Container(NAMESPACE, "forms", "Forms", Choice)) .add(basicAttributes) .mappedBy(new DMRMapping().setAddress("basicAttributes")) .add(new Container(NAMESPACE, "extendedAttributes", "Basic Attributes")) .end() .end().build(); DMRMapping mapping = (DMRMapping) basicAttributes.findMapping(DMR, new Predicate<DMRMapping>() { @Override public boolean appliesTo(DMRMapping candidate) { return true; } }); assertNotNull(mapping); assertEquals("basicAttributes", mapping.getAddress()); mapping = (DMRMapping) basicAttributes.findMapping(DMR, new Predicate<DMRMapping>() { @Override public boolean appliesTo(final DMRMapping candidate) { return "root".equals(candidate.getAddress()); } }); assertNotNull(mapping); assertEquals("root", mapping.getAddress()); }