ContextImpl implements Context { @Override public ApplicationContainerContext getApplicationContainerContext() { Preconditions.checkState(this.applicationContainerContextOptional.isPresent(), "No application-defined container context exists"); return this.applicationContainerContextOptional.get(); } ContextImpl(JobContext jobContext, ContainerContext containerContext, TaskContext taskContext,
      Optional<ApplicationContainerContext> applicationContainerContextOptional,
      Optional<ApplicationTaskContext> applicationTaskContextOptional,
      Optional<ExternalContext> externalContextOptional); @Override JobContext getJobContext(); @Override ContainerContext getContainerContext(); @Override TaskContext getTaskContext(); @Override ApplicationContainerContext getApplicationContainerContext(); @Override ApplicationTaskContext getApplicationTaskContext(); @Override ExternalContext getExternalContext(); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void testGetApplicationContainerContext() { ApplicationContainerContext applicationContainerContext = mock(ApplicationContainerContext.class); Context context = buildWithApplicationContainerContext(applicationContainerContext); assertEquals(applicationContainerContext, context.getApplicationContainerContext()); }
@Test(expected = IllegalStateException.class) public void testGetMissingApplicationContainerContext() { Context context = buildWithApplicationContainerContext(null); context.getApplicationContainerContext(); }