### Question:
RequestContextUtils { public static Optional<InstanceInfo> getInstanceInfo() { Object o = RequestContext.getCurrentContext().get(INSTANCE_INFO_KEY); if (!(o instanceof InstanceInfo)) { return Optional.empty(); } else { return Optional.of((InstanceInfo) o); } } private  RequestContextUtils(); static Optional<InstanceInfo> getInstanceInfo(); static void setInstanceInfo(InstanceInfo info); static void addDebugInfo(String debug); static String getDebugInfo(); static final String INSTANCE_INFO_KEY; static final String DEBUG_INFO_KEY; }### Answer:
@Test void givenRequestContext_whenRequestContextHasInfo_thenRetrieveIt() { InstanceInfo info = InstanceInfo.Builder.newBuilder().setAppName("Francesca").build(); RequestContext.getCurrentContext().set(INSTANCE_INFO_KEY, info); assertThat(RequestContextUtils.getInstanceInfo().isPresent(), is(true)); assertThat(RequestContextUtils.getInstanceInfo().get(), is(info)); }
@Test void givenRequestContext_whenNoInfo_thenRetrieveEmpty() { assertThat(RequestContextUtils.getInstanceInfo().isPresent(), is(false)); }