StackFrame { public Optional<URI> getContextPath() { return contextPath; } StackFrame(final String name, final FrameCategory category, final int level, final StackFrameContext context,
            final Set<URI> loadedResources);   StackFrame(final String name, final FrameCategory category, final int level, final StackFrameContext context);   StackFrame(final String name, final FrameCategory category, final int level, final StackFrameContext context,
            final Supplier<URI> contextPathSupplier); private  StackFrame(final String name, final FrameCategory category, final int level,
            final StackFrameContext context, final Supplier<URI> contextPathSupplier, final Set<URI> loadedResources); String getName(); boolean hasCategory(final FrameCategory category); boolean isSuiteContext(); boolean isSuiteDirectoryContext(); boolean isSuiteFileContext(); boolean isTestContext(); Optional<URI> getCurrentSourcePath(); Optional<URI> getContextPath(); Optional<FileRegion> getFileRegion(); boolean isLibraryKeywordFrame(); boolean isErroneous(); String getErrorMessage(); StackFrameVariables getVariables(); Optional<StackVariablesDelta> getLastDelta();  }
@Test public void thereIsNoContextPath_whenContextDoesNotHaveItAndSupplierDoesNotSupplyAnything() { final StackFrameContext context = mock(StackFrameContext.class); when(context.getAssociatedPath()).thenReturn(Optional.empty()); final StackFrame frame1 = new StackFrame("frame", FrameCategory.SUITE, 42, context); final StackFrame frame2 = new StackFrame("frame", FrameCategory.SUITE, 42, context, newHashSet(URI.create("file: final StackFrame frame3 = new StackFrame("frame", FrameCategory.SUITE, 42, context, () -> null); assertThat(frame1.getContextPath()).isEmpty(); assertThat(frame2.getContextPath()).isEmpty(); assertThat(frame3.getContextPath()).isEmpty(); }
@Test public void thereIsAContextPath_whenContextHaveIt() { final StackFrameContext context = mock(StackFrameContext.class); when(context.getAssociatedPath()).thenReturn(Optional.of(URI.create("file: final StackFrame frame1 = new StackFrame("frame", FrameCategory.SUITE, 42, context); final StackFrame frame2 = new StackFrame("frame", FrameCategory.SUITE, 42, context, newHashSet(URI.create("file: final StackFrame frame3 = new StackFrame("frame", FrameCategory.SUITE, 42, context, () -> null); assertThat(frame1.getContextPath()).contains(URI.create("file: assertThat(frame2.getContextPath()).contains(URI.create("file: assertThat(frame3.getContextPath()).contains(URI.create("file: }
@Test public void thereIsAContextPath_whenContextDoesNotHaveItButSupplierSupplies() { final StackFrameContext context = mock(StackFrameContext.class); when(context.getAssociatedPath()).thenReturn(Optional.empty()); final StackFrame frame = new StackFrame("frame", FrameCategory.SUITE, 42, context, () -> URI.create("file: assertThat(frame.getContextPath()).contains(URI.create("file: }