ExecutionContextStackImpl implements ExecutionContextStack { @Override public String getAbsolutePath(final String path) { if (path.charAt(0) == '/') { return path; } if (!path.startsWith("./")) { return joinPath(getRootPath(), path); } if (isEmpty()) { throw new InvalidExecutionContextException("Relative path not allowed on top of ExecutionContext: " + path); } return joinPath(peek().getPath(), path.substring(2)); } ExecutionContextStackImpl(final String rootPath); @Override ExecutionContext peek(); @Override void push(final ExecutionContext executionContext); @Override ExecutionContext pop(); @Override int size(); @Override String getAbsolutePath(final String path);  }
@Test public void testGetAbsolutePath() { String path = contextStack.getAbsolutePath("/examplePath"); Assert.assertEquals(path, "/examplePath"); path = contextStack.getAbsolutePath("examplePath"); Assert.assertEquals(path, "/content/examplePath"); contextStack.push(new ExecutionContextImpl("/secondContent")); Assert.assertEquals(contextStack.size(), 1); path = contextStack.getAbsolutePath("./examplePath"); Assert.assertEquals(path, "/secondContent/examplePath"); contextStack.pop(); Assert.assertEquals(contextStack.size(), 0); }