Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jdt-dev] Checking if a class is from a test package

If Java Build Path "Source folder" is set to "Contains test Sources", this property can also be used to identify.
 
Thanks & Regards,
Sarika
 
----- Original message -----
From: Mickael Istria <mistria@xxxxxxxxxx>
Sent by: jdt-dev-bounces@xxxxxxxxxxx
To: "Eclipse JDT general developers list." <jdt-dev@xxxxxxxxxxx>
Cc:
Subject: Re: [jdt-dev] Checking if a class is from a test package
Date: Fri, Apr 3, 2020 5:37 PM
 
 
 
On Fri, Apr 3, 2020 at 12:45 PM Gayan Perera <gayanper@xxxxxxxxx> wrote:
How to check a given class is in side test source folder or production source folder.
 
Something like:
 
Arrays.stream(((IPackageFragmentRoot)javaProject.findElement(folder.getPath()).getParent()).getRawClasspathEntry().getExtraAttributes()).anyMatch(att -> "test".equals(att.getName()) && Boolean.parseBoolean(att.getValue()))
might work.
 
HTH
_______________________________________________
jdt-dev mailing list
jdt-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jdt-dev
 


Back to the top