Open mkordas opened 8 years ago
@mkordas please extend the first (invalid) example with a test method, so it will look more like the second one
@krzyk code sample is updated
@mkordas I forgot about other JUnit annotations, which we sometimes use (e.g. @Parameters
), so let's generalize it that we should ignore all fields annotated with any JUnit annotation.
@krzyk @Parameters
is annotation for methods only: http://junit.org/apidocs/org/junit/runners/Parameterized.Parameters.html
You probably meant annotations connected with Theories, right? https://github.com/junit-team/junit/tree/master/src/main/java/org/junit/experimental/theories
@mkordas I added s
:), I meant @Parameterized.Parameter
, singular
@krzyk now I see, description updated
@davvd valid bug
@davvd this is postponed
@davvd valid bug
@krzyk tag bug added to this issue
@davvd this is postponed
@krzyk thanks, I added "postponed" label
@davvd this is postponed
@krzyk someone else will help in this task, no problem at all
@mkordas thank you for reporting this, I added 15 mins to your acc, transaction 5683c3027d0be85794000073
@davvd this is not postponed
@davvd this is urgent
@davvd this is not postponed
@krzyk got it, "postponed" tag removed from here
@davvd this is urgent
@krzyk right, I added "urgent" label
@guiandmag How is the work going?
@guiandmag you're working with this ticket for the last 15 days. If it is not closed within the next 48 hours, it will be re-assigned to someone else, see No Obligations principle. This article should help if you're stuck; added -30 to your rating, now it is equal to -120
@guiandmag it takes too long. Usually, we expect any task to be finished in less than a week. I'll assign someone else. Please stop working with it right now. See our no obligations principle; -60 to your rating, your total score is -180
@davvd this is postponed
@davvd this is postponed
@krzyk got it, "postponed" label here
@davvd this is postponed
@krzyk got it, "urgent" tags removed from here
@davvd this is postponed
@krzyk someone else will help in this task, no problem at all
According to http://www.yegor256.com/2015/05/25/unit-test-scaffolding.html it is bad idea to have fields in test classes, as they create coupling between tests. Exception from the rule are all fields that are annotated, e.g.
@Rule
or@Parameter
, so generally any annotation should skip validation.Check could be implemented either by PMD or Checkstyle rule.
Non-compliant code
Compliant code: