Thanks for the reply.
When I tried that using annotation for a function that has no Lambda 
expression it worked fine, but when there is a lambda expression inside the 
candidate function it does not filter the whole function; only the first 
lines that are not part of the lambda expression.
Is there a way to exclude the whole function or exclude the lambda 
expression inside a function?

@ExcludeFromJacocoGeneratedReport
public void handleArrivedNotifications{
final Authentication auth = SecurityContextHolder.getContext().
getAuthentication();
logger.info("received order to send emails:");
// lambda expression not excluded CompletableFuture.runAsync(() -> {
try {
// body
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
});

}

Best,
Omar

On Monday, October 9, 2023 at 7:55:09 PM UTC+3 Marc Hoffmann wrote:

> Hi,
>
> this is not possible. You may extract the code to its own method.
>
> Regards,
> -marc
>
> On 9. Oct 2023, at 13:33, Omar Al-Haj Qasem <[email protected]> wrote:
>
> I need to exclude code block from code covarge, not just execlude function 
> or class.
> for example, when to exclude if starement or else branch from coverage.
> Is that possible? if not, is there some kind of work around to do so?
>
> Thanks
> Omar
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "JaCoCo and EclEmma Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jacoco/ad190671-52ff-4397-9cd9-41c0533ece6bn%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/jacoco/ad190671-52ff-4397-9cd9-41c0533ece6bn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/8537822e-e4c2-4463-815d-3dc168a99a93n%40googlegroups.com.

Reply via email to