@Test
 public void testBuilderRunWithContextBeingPassed() throws Exception {
   DataFlowInstance dataFlowInstance = new DataFlowInstance();
   dataFlowInstance.setId("testflow");
   dataFlowInstance.setDataFlow(dataFlow);
   {
     DataBuilderContext context = new DataBuilderContext();
     context.saveContextData(KEY, VALUE);
     DataDelta dataDelta =
         new DataDelta(
             Lists.newArrayList(
                 new TestDataA("Hello"), new TestDataB("World"),
                 new TestDataD("this"), new TestDataG("Hmmm")));
     DataExecutionResponse response = executor.run(dataFlowInstance, dataDelta);
     Assert.assertEquals(3, response.getResponses().size());
     Assert.assertTrue(response.getResponses().containsKey("C"));
     Assert.assertTrue(response.getResponses().containsKey("E"));
     Assert.assertTrue(response.getResponses().containsKey("F"));
   }
 }
 @Override
 public void beforeExecute(
     DataBuilderContext builderContext,
     DataFlowInstance dataFlowInstance,
     DataBuilderMeta builderToBeApplied,
     DataDelta dataDelta,
     Map<String, Data> prevResponses)
     throws Exception {
   Assert.assertNotNull(builderContext);
   Assert.assertEquals(builderContext.getContextData(KEY, String.class), VALUE);
 }
 @Override
 public void afterException(
     DataBuilderContext builderContext,
     DataFlowInstance dataFlowInstance,
     DataBuilderMeta builderToBeApplied,
     DataDelta dataDelta,
     Map<String, Data> prevResponses,
     Throwable frameworkException)
     throws Exception {
   Assert.assertNotNull(builderContext);
   Assert.assertEquals(builderContext.getContextData(KEY, String.class), VALUE);
 }
    @Override
    public DataContainer call() throws Exception {

      for (DataBuilderExecutionListener listener : dataBuilderExecutionListener) {
        try {
          listener.beforeExecute(dataFlowInstance, builderMeta, dataDelta, responseData);
        } catch (Throwable t) {
          logger.error("Error running pre-execution execution listener: ", t);
        }
      }
      try {
        Data response =
            builder.process(
                dataBuilderContext.immutableCopy(
                    dataSet.accessor().getAccesibleDataSetFor(builder)));
        // logger.debug("Ran " + builderMeta.getName());
        procesedBuilders.add(builderMeta);
        for (DataBuilderExecutionListener listener : dataBuilderExecutionListener) {
          try {
            listener.afterExecute(dataFlowInstance, builderMeta, dataDelta, responseData, response);
          } catch (Throwable t) {
            logger.error("Error running post-execution listener: ", t);
          }
        }
        if (null != response) {
          Preconditions.checkArgument(
              response.getData().equalsIgnoreCase(builderMeta.getProduces()),
              String.format(
                  "Builder is supposed to produce %s but produces %s",
                  builderMeta.getProduces(), response.getData()));
          response.setGeneratedBy(builderMeta.getName());
        }
        return new DataContainer(builderMeta, response);
      } catch (DataBuilderException e) {
        logger.error("Error running builder: " + builderMeta.getName());
        for (DataBuilderExecutionListener listener : dataBuilderExecutionListener) {
          try {
            listener.afterException(dataFlowInstance, builderMeta, dataDelta, responseData, e);

          } catch (Throwable error) {
            logger.error("Error running post-execution listener: ", error);
          }
        }
        return new DataContainer(
            builderMeta,
            new DataBuilderFrameworkException(
                DataBuilderFrameworkException.ErrorCode.BUILDER_EXECUTION_ERROR,
                "Error running builder: " + builderMeta.getName(),
                e.getDetails(),
                e));

      } catch (DataValidationException e) {
        logger.error("Validation error in data produced by builder" + builderMeta.getName());
        for (DataBuilderExecutionListener listener : dataBuilderExecutionListener) {
          try {
            listener.afterException(dataFlowInstance, builderMeta, dataDelta, responseData, e);

          } catch (Throwable error) {
            logger.error("Error running post-execution listener: ", error);
          }
        }
        return new DataContainer(
            builderMeta,
            new DataValidationException(
                DataValidationException.ErrorCode.DATA_VALIDATION_EXCEPTION,
                "Error running builder: " + builderMeta.getName(),
                new DataExecutionResponse(responseData),
                e.getDetails(),
                e));

      } catch (Throwable t) {
        logger.error("Error running builder: " + builderMeta.getName());
        for (DataBuilderExecutionListener listener : dataBuilderExecutionListener) {
          try {
            listener.afterException(dataFlowInstance, builderMeta, dataDelta, responseData, t);

          } catch (Throwable error) {
            logger.error("Error running post-execution listener: ", error);
          }
        }
        Map<String, Object> objectMap = new HashMap<String, Object>();
        objectMap.put("MESSAGE", t.getMessage());
        return new DataContainer(
            builderMeta,
            new DataBuilderFrameworkException(
                DataBuilderFrameworkException.ErrorCode.BUILDER_EXECUTION_ERROR,
                "Error running builder: " + builderMeta.getName() + t.getMessage(),
                objectMap,
                t));
      }
    }