You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Nick Williams <ni...@nicholaswilliams.net> on 2013/09/12 19:31:16 UTC

Where to put a helper class for test?

Mark,

I'm working on revisions to my patch for BZ 55317 based on your feedback. In this feedback you said:

> 5. I'm not a fan of the org.apache.tomcat.unittest package unless the classes concerned are going to be used by multiple tests across multiple packages.

I put org.apache.tomcat.unittest.weaving.NeverUsedClass and org.apache.tomcat.unittest.weaving.UnweavedClass in this package because it seemed like a location that "helper" classes were being placed for other tests. However, I see your point about them only being used for one class. Should I just put these classes in org.apache.catalina.loader, the same package that TestWebappClassLoaderWeaving is in?

Thanks,

Nick

Re: Where to put a helper class for test?

Posted by Christopher Schultz <ch...@christopherschultz.net>.
Nick,

On 9/12/13 2:12 PM, Nick Williams wrote:
> 
> On Sep 12, 2013, at 1:03 PM, Mark Thomas wrote:
> 
>> On 12/09/2013 18:31, Nick Williams wrote:
>>> Mark,
>>>
>>> I'm working on revisions to my patch for BZ 55317 based on your
>>> feedback. In this feedback you said:
>>>
>>>> 5. I'm not a fan of the org.apache.tomcat.unittest package unless
>>>> the classes concerned are going to be used by multiple tests across
>>>> multiple packages.
>>>
>>> I put org.apache.tomcat.unittest.weaving.NeverUsedClass and
>>> org.apache.tomcat.unittest.weaving.UnweavedClass in this package
>>> because it seemed like a location that "helper" classes were being
>>> placed for other tests. However, I see your point about them only
>>> being used for one class. Should I just put these classes in
>>> org.apache.catalina.loader, the same package that
>>> TestWebappClassLoaderWeaving is in?
>>
>> That is the normal convention. Convention is also that they start
>> Tester... so they are excluded from the unit test scan.
>>
>> Mark
> 
> Okay. So I should rename the classes:
> 
> org.apache.catalina.loader.TesterNeverUsedClass
> org.apache.catalina.loader.TesterUnweavedClass
> 
> Did I understand that correctly?

What about using static inner classes in your test case?

-chris


Re: Where to put a helper class for test?

Posted by Nick Williams <ni...@nicholaswilliams.net>.
On Sep 12, 2013, at 1:03 PM, Mark Thomas wrote:

> On 12/09/2013 18:31, Nick Williams wrote:
>> Mark,
>> 
>> I'm working on revisions to my patch for BZ 55317 based on your
>> feedback. In this feedback you said:
>> 
>>> 5. I'm not a fan of the org.apache.tomcat.unittest package unless
>>> the classes concerned are going to be used by multiple tests across
>>> multiple packages.
>> 
>> I put org.apache.tomcat.unittest.weaving.NeverUsedClass and
>> org.apache.tomcat.unittest.weaving.UnweavedClass in this package
>> because it seemed like a location that "helper" classes were being
>> placed for other tests. However, I see your point about them only
>> being used for one class. Should I just put these classes in
>> org.apache.catalina.loader, the same package that
>> TestWebappClassLoaderWeaving is in?
> 
> That is the normal convention. Convention is also that they start
> Tester... so they are excluded from the unit test scan.
> 
> Mark

Okay. So I should rename the classes:

org.apache.catalina.loader.TesterNeverUsedClass
org.apache.catalina.loader.TesterUnweavedClass

Did I understand that correctly?

Nick

Re: Where to put a helper class for test?

Posted by Mark Thomas <ma...@apache.org>.
On 12/09/2013 18:31, Nick Williams wrote:
> Mark,
> 
> I'm working on revisions to my patch for BZ 55317 based on your
> feedback. In this feedback you said:
> 
>> 5. I'm not a fan of the org.apache.tomcat.unittest package unless
>> the classes concerned are going to be used by multiple tests across
>> multiple packages.
> 
> I put org.apache.tomcat.unittest.weaving.NeverUsedClass and
> org.apache.tomcat.unittest.weaving.UnweavedClass in this package
> because it seemed like a location that "helper" classes were being
> placed for other tests. However, I see your point about them only
> being used for one class. Should I just put these classes in
> org.apache.catalina.loader, the same package that
> TestWebappClassLoaderWeaving is in?

That is the normal convention. Convention is also that they start
Tester... so they are excluded from the unit test scan.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org