private static Context buildWithApplicationContext(ApplicationContainerContext applicationContainerContext,
      ApplicationTaskContext applicationTaskContext, ExternalContext externalContext) {
    return new ContextImpl(mock(JobContext.class), mock(ContainerContext.class), mock(TaskContext.class),
        Optional.ofNullable(applicationContainerContext), Optional.ofNullable(applicationTaskContext),
        Optional.ofNullable(externalContext));
  }
Given no concrete context, getExternalContext should throw an exception.
samza-core/src/test/java/org/apache/samza/context/TestContextImpl.java