Source extends File { protected Resource bind(final ResourceManager resourceManager, final String importPath) { if (importPath.startsWith("./") || importPath.startsWith("../")) { final String location = getLocation(); logger.trace("Location: {}", location); final String parent = getParentPath(getLocation()); logger.trace("Parent: {}", parent); return resourceManager.getResource(append(parent, importPath)); } else { return resourceManager.getPackage(importPath); } } Source(final Project project, final String location); @Override List<Resource> getDependencies(final ResourceManager resourceManager); List<String> readImports(); Text getBody(); @Override int hashCode(); @Override boolean equals(Object obj);  }
@Test public void testBind() throws Exception { final ProjectFile projectFile = new ProjectFile(); final Project project = new Project(randomUUID().toString(), projectFile); final Source source = new Source(project, randomUUID().toString()); final ResourceManager resourceManager = mock(ResourceManager.class); source.bind(resourceManager, "../subsource.lua"); verify(resourceManager).getResource(anyString()); source.bind(resourceManager, "subpackage"); verify(resourceManager).getPackage(anyString()); }