code: private static void assertProducer(InteractionUnit unit, Map<QName, Set<Procedure>> behaviours, IntegrityErrors err) {
          Set<Resource<ResourceType>> consumedTypes = unit.getInputs();
  
          for (Resource<ResourceType> resource : consumedTypes) {
              boolean match = false;
  
              for(QName id : behaviours.keySet())
              {
                  for (Behaviour candidate : behaviours.get(id)) {
                      if (candidate.doesProduce(resource)) {
                          match = candidate.getJustification() == null || unit.getId().equals(candidate.getJustification());
                      }
  
                      if(match)break;
                  }
  
                  if(match)break;
              }
  
              if (!match)
                  err.add(unit.getId(), "Missing producer for <<" + resource + ">>");
          }
      }
docs: Assertion that a producer exists for the consumed resources of an interaction unit.
  
  @param unit
  @param behaviours
  @param err