Skip to content

Commit

Permalink
Include FileObject (and its lookup) even when working with whole Project
Browse files Browse the repository at this point in the history
  • Loading branch information
jtulach committed Feb 25, 2024
1 parent 372da96 commit bd3abb8
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,22 @@ public void testFindsWithFileObjectAndDataObject() throws Exception {
assertEquals(prj, lkp.lookup(Project.class));
}

@Test
public void testFindsWithFileObjectAndDataObjectNoMethod() throws Exception {
FileObject dir = FileUtil.createMemoryFileSystem().getRoot().createFolder("testprj");
FileObject xml = dir.createData("build.xml");
Project prj = ProjectManager.getDefault().findProject(dir);
assertNotNull("Project dir recognized", prj);

Lookup lkp = NbLaunchDelegate.createTargetLookup(prj, null, xml);
assertEquals("File object is available", xml, lkp.lookup(FileObject.class));
DataObject obj = lkp.lookup(DataObject.class);
assertNotNull("DataObject is available", obj);
assertEquals("DataObject's FileObject is correct", xml, obj.getPrimaryFile());
assertNull("No Single method is present", lkp.lookup(SingleMethod.class));
assertEquals(prj, lkp.lookup(Project.class));
}

@Test
public void testAvoidNPEWithoutActionsProviderInLookup() throws Exception {
MockProjectFactory.MockProject prj = new MockProjectFactory.MockProject(FileUtil.getConfigRoot());
Expand Down

0 comments on commit bd3abb8

Please sign in to comment.