Hello,

I have tests that can be run only on certain operation system (namely Windows 
and Linux). They test that some file operation - specific to each system - 
works:

For Windows:

  @Override
  protected DosFileAttributes mapAttributes(BasicFileAttributes attr) {
    if (attr instanceof DosFileAttributes) {
      return (DosFileAttributes) attr;
    }
    return null;
  }

For Linux:

  @Override
  protected BasicFileAttributes mapAttributes(BasicFileAttributes attr) {
    return attr;
  }

The code coverage will be obviously 0% when run on Windows or Linux.

I'd like to know if there was some annotations already existing that could 
avoid this case:

  @Coverage(ignoreWhenOperationSystemIsNot = {WINDOWS})
  @Override
  protected DosFileAttributes mapAttributes(BasicFileAttributes attr) {
    if (attr instanceof DosFileAttributes) {
      return (DosFileAttributes) attr;
    }
    return null;
  }

  @Coverage(ignoreWhenOperationSystemIsNot = {LINUX})
  @Override
  protected BasicFileAttributes mapAttributes(BasicFileAttributes attr) {
    return attr;
  }

The @Coverage annotation would work like this: ignore the class or method in 
coverage result only if OS does not match expected.

-- 
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/464ca973-d643-430b-b6d2-1802bd27e8ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to