Skip to content

Commit

Permalink
Exception in missing tests view
Browse files Browse the repository at this point in the history
The content provider doesn't deal with Java files not containing a type,
like package-info.java
  • Loading branch information
Bananeweizen authored and RoiSoleil committed Dec 11, 2023
1 parent bb5b328 commit bd9a502
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

public class MissingClassTreeContentProvider implements ITreeContentProvider
{

public MissingClassTreeContentProvider()
{

}

public Object[] getChildren(Object arg0)
Expand Down Expand Up @@ -57,9 +57,14 @@ public Object[] getElements(Object inputElement)
ICompilationUnit[] compilationUnits = ((IPackageFragment) javaPackage).getCompilationUnits();
for (ICompilationUnit compilationUnit : compilationUnits)
{
ClassTypeFacade classTypeFacade = new ClassTypeFacade(compilationUnit);
if(!TypeFacade.isTestCase(compilationUnit) && !classTypeFacade.hasTestCase())
elements.add(compilationUnit);
if(compilationUnit.findPrimaryType() != null)
{
ClassTypeFacade classTypeFacade = new ClassTypeFacade(compilationUnit);
if(! TypeFacade.isTestCase(compilationUnit) && ! classTypeFacade.hasTestCase())
{
elements.add(compilationUnit);
}
}
}
}
}
Expand Down

0 comments on commit bd9a502

Please sign in to comment.