You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by br...@apache.org on 2013/04/10 19:48:29 UTC
svn commit: r1466591 -
/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java
Author: britter
Date: Wed Apr 10 17:48:28 2013
New Revision: 1466591
URL: http://svn.apache.org/r1466591
Log:
Give test a better name
Modified:
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java
Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java?rev=1466591&r1=1466590&r2=1466591&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java (original)
+++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java Wed Apr 10 17:48:28 2013
@@ -58,7 +58,7 @@ public class CSVLexerTest {
}
@Test
- public void testIgnoreSurroundingSpacesAreDeleted() throws IOException {
+ public void testSurroundingSpacesAreDeleted() throws IOException {
final String code = "noSpaces, leadingSpaces,trailingSpaces , surroundingSpaces , ,,";
final Lexer parser = getLexer(code, CSVFormat.newBuilder().withIgnoreSurroundingSpaces(true).build());
assertThat(parser.nextToken(new Token()), matches(TOKEN, "noSpaces"));
Re: svn commit: r1466591 - /commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java
Posted by sebb <se...@gmail.com>.
On 12 April 2013 07:30, Benedikt Ritter <br...@apache.org> wrote:
> I don't prefer one or the other. Both styles have their pros and cons. I
> just don't want to mix them.
>
>
I don't mind too much if they are mixed - but obviously not in the same
class.
> In JUnit 3 you would write something like:
>
> public void testMyMethodNull() throws Exception {
> try {
> bean.myMethod(null);
> fail("Passing null to myMethod did not throw exception!");
> catch (NullPointException expected) {
> // expected, do nothing
> }
> }
>
> Where as in JUnit 4 you may write:
>
> @Test(expected = NullPointerException.class)
> public void passingNullToMyMethodThrowsNPE() throws Exception {
> bean.myMethod(null);
> }
>
>
That works well if the only possible source of the NPE is the statement
under test, but JUnit4 does not detect which statement causes the NPE.
I have a slight preference for the second variant, but as I said for CSV I
> would leave it as is for now.
>
Tend to agree here.
> Thanks for your comments.
>
> Benedikt
>
>
> 2013/4/10 Gary Gregory <ga...@gmail.com>
>
> > On Apr 10, 2013, at 17:24, Emmanuel Bourg <eb...@apache.org> wrote:
> >
> > > Le 10/04/2013 23:18, Benedikt Ritter a écrit :
> > >
> > >> Yes, I agree (I liked that in BU2) but CSV still uses the old JUnit
> 3.x
> > >> convention of prefixing tests with "test". I'm not sure whether it's a
> > good
> > >> idea to start mixing this styles. WDYT?
> > >
> > > I agree. I always preferred the JUnit 3.x style anyway.
> >
> > +1
> >
> > Gary
> >
> > >
> > > Emmanuel Bourg
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > For additional commands, e-mail: dev-help@commons.apache.org
> >
> >
>
>
> --
> http://people.apache.org/~britter/
> http://www.systemoutprintln.de/
> http://twitter.com/BenediktRitter
> http://github.com/britter
>
Re: svn commit: r1466591 - /commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java
Posted by Benedikt Ritter <br...@apache.org>.
I don't prefer one or the other. Both styles have their pros and cons. I
just don't want to mix them.
In JUnit 3 you would write something like:
public void testMyMethodNull() throws Exception {
try {
bean.myMethod(null);
fail("Passing null to myMethod did not throw exception!");
catch (NullPointException expected) {
// expected, do nothing
}
}
Where as in JUnit 4 you may write:
@Test(expected = NullPointerException.class)
public void passingNullToMyMethodThrowsNPE() throws Exception {
bean.myMethod(null);
}
I have a slight preference for the second variant, but as I said for CSV I
would leave it as is for now.
Thanks for your comments.
Benedikt
2013/4/10 Gary Gregory <ga...@gmail.com>
> On Apr 10, 2013, at 17:24, Emmanuel Bourg <eb...@apache.org> wrote:
>
> > Le 10/04/2013 23:18, Benedikt Ritter a écrit :
> >
> >> Yes, I agree (I liked that in BU2) but CSV still uses the old JUnit 3.x
> >> convention of prefixing tests with "test". I'm not sure whether it's a
> good
> >> idea to start mixing this styles. WDYT?
> >
> > I agree. I always preferred the JUnit 3.x style anyway.
>
> +1
>
> Gary
>
> >
> > Emmanuel Bourg
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>
--
http://people.apache.org/~britter/
http://www.systemoutprintln.de/
http://twitter.com/BenediktRitter
http://github.com/britter
Re: svn commit: r1466591 - /commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java
Posted by Gary Gregory <ga...@gmail.com>.
On Apr 10, 2013, at 17:24, Emmanuel Bourg <eb...@apache.org> wrote:
> Le 10/04/2013 23:18, Benedikt Ritter a écrit :
>
>> Yes, I agree (I liked that in BU2) but CSV still uses the old JUnit 3.x
>> convention of prefixing tests with "test". I'm not sure whether it's a good
>> idea to start mixing this styles. WDYT?
>
> I agree. I always preferred the JUnit 3.x style anyway.
+1
Gary
>
> Emmanuel Bourg
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: svn commit: r1466591 - /commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java
Posted by Emmanuel Bourg <eb...@apache.org>.
Le 10/04/2013 23:18, Benedikt Ritter a écrit :
> Yes, I agree (I liked that in BU2) but CSV still uses the old JUnit 3.x
> convention of prefixing tests with "test". I'm not sure whether it's a good
> idea to start mixing this styles. WDYT?
I agree. I always preferred the JUnit 3.x style anyway.
Emmanuel Bourg
Re: svn commit: r1466591 - /commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java
Posted by Benedikt Ritter <br...@apache.org>.
Hi Simo,
2013/4/10 Simone Tripodi <si...@apache.org>
> just an idea: the `test` prefix on methods signature can be now omitted,
> since they are already marked with @Test
>
Yes, I agree (I liked that in BU2) but CSV still uses the old JUnit 3.x
convention of prefixing tests with "test". I'm not sure whether it's a good
idea to start mixing this styles. WDYT?
>
> my 0.0002 cents,
> -Simo
>
> http://people.apache.org/~simonetripodi/
> http://simonetripodi.livejournal.com/
> http://twitter.com/simonetripodi
> http://www.99soft.org/
>
>
> On Wed, Apr 10, 2013 at 7:48 PM, <br...@apache.org> wrote:
>
> > Author: britter
> > Date: Wed Apr 10 17:48:28 2013
> > New Revision: 1466591
> >
> > URL: http://svn.apache.org/r1466591
> > Log:
> > Give test a better name
> >
> > Modified:
> >
> >
> commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java
> >
> > Modified:
> >
> commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java
> > URL:
> >
> http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java?rev=1466591&r1=1466590&r2=1466591&view=diff
> >
> >
> ==============================================================================
> > ---
> >
> commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java
> > (original)
> > +++
> >
> commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java
> > Wed Apr 10 17:48:28 2013
> > @@ -58,7 +58,7 @@ public class CSVLexerTest {
> > }
> >
> > @Test
> > - public void testIgnoreSurroundingSpacesAreDeleted() throws
> > IOException {
> > + public void testSurroundingSpacesAreDeleted() throws IOException {
> > final String code = "noSpaces, leadingSpaces,trailingSpaces ,
> > surroundingSpaces , ,,";
> > final Lexer parser = getLexer(code,
> > CSVFormat.newBuilder().withIgnoreSurroundingSpaces(true).build());
> > assertThat(parser.nextToken(new Token()), matches(TOKEN,
> > "noSpaces"));
> >
> >
> >
>
--
http://people.apache.org/~britter/
http://www.systemoutprintln.de/
http://twitter.com/BenediktRitter
http://github.com/britter
Re: svn commit: r1466591 - /commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java
Posted by Simone Tripodi <si...@apache.org>.
just an idea: the `test` prefix on methods signature can be now omitted,
since they are already marked with @Test
my 0.0002 cents,
-Simo
http://people.apache.org/~simonetripodi/
http://simonetripodi.livejournal.com/
http://twitter.com/simonetripodi
http://www.99soft.org/
On Wed, Apr 10, 2013 at 7:48 PM, <br...@apache.org> wrote:
> Author: britter
> Date: Wed Apr 10 17:48:28 2013
> New Revision: 1466591
>
> URL: http://svn.apache.org/r1466591
> Log:
> Give test a better name
>
> Modified:
>
> commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java
>
> Modified:
> commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java
> URL:
> http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java?rev=1466591&r1=1466590&r2=1466591&view=diff
>
> ==============================================================================
> ---
> commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java
> (original)
> +++
> commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVLexerTest.java
> Wed Apr 10 17:48:28 2013
> @@ -58,7 +58,7 @@ public class CSVLexerTest {
> }
>
> @Test
> - public void testIgnoreSurroundingSpacesAreDeleted() throws
> IOException {
> + public void testSurroundingSpacesAreDeleted() throws IOException {
> final String code = "noSpaces, leadingSpaces,trailingSpaces ,
> surroundingSpaces , ,,";
> final Lexer parser = getLexer(code,
> CSVFormat.newBuilder().withIgnoreSurroundingSpaces(true).build());
> assertThat(parser.nextToken(new Token()), matches(TOKEN,
> "noSpaces"));
>
>
>