Re: @TestOnly or @VisibleForTesting

2021-11-05 Thread Dale Emery
actual responsibility.) That last one kinda scares me. I also noted that some elements annotated as @VisibleForTesting are not referenced by any test. Dale From: Alexander Murmann Date: Thursday, November 4, 2021 at 5:02 PM To: dev@geode.apache.org Subject: Re: @TestOnly or @VisibleForTesting

Re: @TestOnly or @VisibleForTesting

2021-11-05 Thread Kirk Lund
For constructors, I suggest that we don't need to use either annotation. A package-private constructor that accepts parameters for all dependencies is not breaking encapsulation or exposing internals and is very appropriate for constructor based injection. It adheres to best practices as set out fo

Re: @TestOnly or @VisibleForTesting

2021-11-05 Thread Owen Nichols
@VisibileForTesting is bad. It does NOT tell you if the method SHOULD HAVE BEEN private, or package-private, or protected, so there is no way to reconstruct the originally-intended code if the annotation is ever removed. It also prevents the exposed methods from being named in a way that clear

Re: @TestOnly or @VisibleForTesting

2021-11-05 Thread Kirk Lund
I'm ok with not using these annotations, but we still need to write *unit tests* in addition to end-to-end *system tests*. I started this thread primarily to standardize on how we use one or both annotations. We shouldn't be using both arbitrarily without some sort of guidelines. If we want to ac

Re: @TestOnly or @VisibleForTesting

2021-11-05 Thread Robert Houghton
Houghton From: Mark Hanson Date: Friday, November 5, 2021 at 10:11 AM To: dev@geode.apache.org Subject: Re: @TestOnly or @VisibleForTesting I generally see @VisibleForTesting used to change permissions of a private method, which is inaccessible to an external object, into a public method to allow a

Re: @TestOnly or @VisibleForTesting

2021-11-05 Thread Mark Hanson
r and by tests. In order for tests to call it, we have to make it visible, so we mark it as @VisibleForTesting. Dale From: Alexander Murmann Date: Thursday, November 4, 2021 at 5:02 PM To: dev@geode.apache.org Subject: Re: @TestOnly or @VisibleForTesting Another +1

Re: @TestOnly or @VisibleForTesting

2021-11-05 Thread Dale Emery
constructor is called only by the old constructor and by tests. In order for tests to call it, we have to make it visible, so we mark it as @VisibleForTesting. Dale From: Alexander Murmann Date: Thursday, November 4, 2021 at 5:02 PM To: dev@geode.apache.org Subject: Re: @TestOnly or @VisibleForTesting

Re: @TestOnly or @VisibleForTesting

2021-11-05 Thread Darrel Schneider
Subject: Re: @TestOnly or @VisibleForTesting The main time I use the @VisibleForTesting annotation is when I'm unit testing a method that includes static calls that can't be mocked or verified. A random example from the codebase is LatestLastAccessTimeMessage.process() which has

Re: @TestOnly or @VisibleForTesting

2021-11-05 Thread Donal Evans
e: @TestOnly or @VisibleForTesting Another +1 to Eric's point. What are others seeing as valid use cases for those annotations? From: Patrick Johnson Sent: Thursday, November 4, 2021 15:55 To: dev@geode.apache.org Subject: Re: @TestOnly or @VisibleForTesting I agree wit

Re: @TestOnly or @VisibleForTesting

2021-11-04 Thread Alexander Murmann
Another +1 to Eric's point. What are others seeing as valid use cases for those annotations? From: Patrick Johnson Sent: Thursday, November 4, 2021 15:55 To: dev@geode.apache.org Subject: Re: @TestOnly or @VisibleForTesting I agree with Eric. Maybe rather

Re: @TestOnly or @VisibleForTesting

2021-11-04 Thread Jinmei Liao
better identification), but I do find it useful to add @VisibleForTesting methods while making unit tests. From: Patrick Johnson Date: Thursday, November 4, 2021 at 3:56 PM To: dev@geode.apache.org Subject: Re: @TestOnly or @VisibleForTesting I agree with Eric. Maybe rather than standardizing on one

Re: @TestOnly or @VisibleForTesting

2021-11-04 Thread Patrick Johnson
that can be tested on its own. > > The same could probably be said for @TestOnly unless there are actually > static analysis tools that need it for some reason. > > From: Kirk Lund > Date: Thursday, November 4, 2021 at 15:13 > To: dev@geode.apache.org > Subject: Re:

Re: @TestOnly or @VisibleForTesting

2021-11-04 Thread Owen Nichols
are actually static analysis tools that need it for some reason. From: Kirk Lund Date: Thursday, November 4, 2021 at 15:13 To: dev@geode.apache.org Subject: Re: @TestOnly or @VisibleForTesting As everyone thinks about how we want to use these annotations, please k

Re: @TestOnly or @VisibleForTesting

2021-11-04 Thread Eric Zoerner
class that has a wider visibility that can be tested on its own. The same could probably be said for @TestOnly unless there are actually static analysis tools that need it for some reason. From: Kirk Lund Date: Thursday, November 4, 2021 at 15:13 To: dev@geode.apache.org Subject: Re: @TestOnly

Re: @TestOnly or @VisibleForTesting

2021-11-04 Thread Kirk Lund
As everyone thinks about how we want to use these annotations, please keep this in mind that both *@VisibleForTesting* and *@TestOnly* can be used on Types (Class/Interface/Enum), Constructors, Methods and Fields. (not just Methods) On Thu, Nov 4, 2021 at 3:09 PM Kirk Lund wrote: > Hey all, > >