You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Chris Hostetter <ho...@fucit.org> on 2006/08/01 10:43:25 UTC

Re: EMAIL ADDRESS: Tokenize (i.e. an EmailAnalyzer)

: Sure I would love to!  Can you ping me at michael.prichard@mac.com and
: let me know what I need to do?   Do I just post it to JIRA?

instructions on submitting code can be found in the wiki..

http://wiki.apache.org/jakarta-lucene/HowToContribute

note in particular that since you are primarily submiting new files,
you'll need to "svn add" them locally in order for them to be included in
patches created by "svn diff".

As for where it might make sense for them to live: there is an existing
"contrib/analyzers" package which might make the most sense.

Also note that while test cases aren't stricly mandatory for newly
contributed code, it does go a long way towards documenting expected
behavior, and encouraging committers to commit it :)



-Hoss


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: EMAIL ADDRESS: Tokenize (i.e. an EmailAnalyzer)

Posted by Simon Willnauer <si...@googlemail.com>.
Hey Michael,

you might fall in love with the green bar after using it for a while.
If you use eclipse or some other ide including junit it so easy and powerful.

You might find some help here as well:

http://www.onjava.com/pub/a/onjava/2004/02/04/juie.html
http://www.junit.org/news/article/index.htm

As hossman said very important is to test limit values of  your "unit".
You should also let your test fail at the right moment and catch the
exception to test it for illegal values or state.
Something like that does a good job if you expect an exc.


try{
unit.doIt();
fail("illegal state");
}catch(theexc e){}

Have a look at the class junit.framework.Assert, the static methods
are very helpful.

to keep the code clean, keep the bar green :)

Simon



On 8/4/06, Chris Hostetter <ho...@fucit.org> wrote:
>
> : Oh boy, how embarrassing for me.  I have never used any unit tests...I
> : know I know...don't freak out people :)  I pretty much just started
> : really coding in Java.  So, is there anyone out there who has time to
> : help me add these to the code?  I would appreciate it and, on the plus
> : side, the code will be better tested for the community.
>
> Writing unit tests is a lot easier then it sounds .. especially if you are
> writting them as they are ment to be: test of small "units" of code.
>
> take al ook at some of the existing Filter tests, they should give you a
> good idea of how to write a test...
>
> http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java?revision=347991&view=markup
> http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/analysis/TestLengthFilter.java?view=markup
> http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/analysis/TestStopFilter.java?revision=382158&view=markup
>
> ..the ideal thing is to not only test the expected "good" cases, but
> also any cases where you expect an error to be generated -- not exactly
> common in a TokenFilter, but it would be a good idea for example to test
> what your Filter does when given plain text (ie: not an email address)
>
>
>
>
>
>
> -Hoss
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: EMAIL ADDRESS: Tokenize (i.e. an EmailAnalyzer)

Posted by Chris Hostetter <ho...@fucit.org>.
: Oh boy, how embarrassing for me.  I have never used any unit tests...I
: know I know...don't freak out people :)  I pretty much just started
: really coding in Java.  So, is there anyone out there who has time to
: help me add these to the code?  I would appreciate it and, on the plus
: side, the code will be better tested for the community.

Writing unit tests is a lot easier then it sounds .. especially if you are
writting them as they are ment to be: test of small "units" of code.

take al ook at some of the existing Filter tests, they should give you a
good idea of how to write a test...

http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/analysis/TestISOLatin1AccentFilter.java?revision=347991&view=markup
http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/analysis/TestLengthFilter.java?view=markup
http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/analysis/TestStopFilter.java?revision=382158&view=markup

..the ideal thing is to not only test the expected "good" cases, but
also any cases where you expect an error to be generated -- not exactly
common in a TokenFilter, but it would be a good idea for example to test
what your Filter does when given plain text (ie: not an email address)






-Hoss


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: EMAIL ADDRESS: Tokenize (i.e. an EmailAnalyzer)

Posted by "Michael J. Prichard" <mi...@mac.com>.
Chris Hostetter wrote:

>: Sure I would love to!  Can you ping me at michael.prichard@mac.com and
>: let me know what I need to do?   Do I just post it to JIRA?
>
>instructions on submitting code can be found in the wiki..
>
>http://wiki.apache.org/jakarta-lucene/HowToContribute
>
>note in particular that since you are primarily submiting new files,
>you'll need to "svn add" them locally in order for them to be included in
>patches created by "svn diff".
>
>As for where it might make sense for them to live: there is an existing
>"contrib/analyzers" package which might make the most sense.
>
>Also note that while test cases aren't stricly mandatory for newly
>contributed code, it does go a long way towards documenting expected
>behavior, and encouraging committers to commit it :)
>
>
>
>-Hoss
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>For additional commands, e-mail: java-user-help@lucene.apache.org
>
>  
>
Oh boy, how embarrassing for me.  I have never used any unit tests...I 
know I know...don't freak out people :)  I pretty much just started 
really coding in Java.  So, is there anyone out there who has time to 
help me add these to the code?  I would appreciate it and, on the plus 
side, the code will be better tested for the community.

Thanks!
Michael

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org