You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Julius Davies <ju...@gmail.com> on 2010/03/27 06:21:41 UTC

Re: svn commit: r928129 - /commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64Test.java

Hi,

I think there's a mistake here (even though it's commented out):

//assertEquals("foo",
StringUtils.newStringUsAscii(Base64.decodeBase64("Zm9v" +
Base64.CHUNK_SEPARATOR)));


Consider output of following:

        String s = "Zm9v" + Base64.CHUNK_SEPARATOR;
        System.out.println(s);

The output is:

        Zm9v[B@6bbc4459


I've attached a fix to CODEC-99 as 'codec-99-test-fixes.patch'.


yours,

Julius


> +    public void testRfc4648Section10DecodeWithCrLf() {
> +        assertEquals("", StringUtils.newStringUsAscii(Base64.decodeBase64("")));
> +        assertEquals("f", StringUtils.newStringUsAscii(Base64.decodeBase64("Zg==" + Base64.CHUNK_SEPARATOR)));
> +        assertEquals("fo", StringUtils.newStringUsAscii(Base64.decodeBase64("Zm8=" + Base64.CHUNK_SEPARATOR)));
> +        //assertEquals("foo", StringUtils.newStringUsAscii(Base64.decodeBase64("Zm9v" + Base64.CHUNK_SEPARATOR)));
> +        assertEquals("foob", StringUtils.newStringUsAscii(Base64.decodeBase64("Zm9vYg==" + Base64.CHUNK_SEPARATOR)));
> +        assertEquals("fooba", StringUtils.newStringUsAscii(Base64.decodeBase64("Zm9vYmE=" + Base64.CHUNK_SEPARATOR)));
> +        //assertEquals("foobar", StringUtils.newStringUsAscii(Base64.decodeBase64("Zm9vYmFy" + Base64.CHUNK_SEPARATOR)));
> +    }
> +



-- 
yours,

Julius Davies
250-592-2284 (Home)
250-893-4579 (Mobile)

$ sudo apt-get install cowsay
$ echo "Moo." | cowsay | cowsay -n | cowsay -n
http://juliusdavies.ca/cowsay/

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


RE: svn commit: r928129 - /commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64Test.java

Posted by Gary Gregory <GG...@seagullsoftware.com>.
Ah, yes, good catch. 
Thank you,
Gary
> -----Original Message-----
> From: Julius Davies [mailto:juliusdavies@gmail.com]
> Sent: Friday, March 26, 2010 22:22
> To: dev@commons.apache.org
> Subject: Re: svn commit: r928129 -
> /commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Ba
> se64Test.java
> 
> Hi,
> 
> I think there's a mistake here (even though it's commented out):
> 
> //assertEquals("foo",
> StringUtils.newStringUsAscii(Base64.decodeBase64("Zm9v" +
> Base64.CHUNK_SEPARATOR)));
> 
> 
> Consider output of following:
> 
>         String s = "Zm9v" + Base64.CHUNK_SEPARATOR;
>         System.out.println(s);
> 
> The output is:
> 
>         Zm9v[B@6bbc4459
> 
> 
> I've attached a fix to CODEC-99 as 'codec-99-test-fixes.patch'.
> 
> 
> yours,
> 
> Julius
> 
> 
> > +    public void testRfc4648Section10DecodeWithCrLf() {
> > +        assertEquals("",
> StringUtils.newStringUsAscii(Base64.decodeBase64("")));
> > +        assertEquals("f",
> StringUtils.newStringUsAscii(Base64.decodeBase64("Zg==" +
> Base64.CHUNK_SEPARATOR)));
> > +        assertEquals("fo",
> StringUtils.newStringUsAscii(Base64.decodeBase64("Zm8=" +
> Base64.CHUNK_SEPARATOR)));
> > +        //assertEquals("foo",
> StringUtils.newStringUsAscii(Base64.decodeBase64("Zm9v" +
> Base64.CHUNK_SEPARATOR)));
> > +        assertEquals("foob",
> StringUtils.newStringUsAscii(Base64.decodeBase64("Zm9vYg==" +
> Base64.CHUNK_SEPARATOR)));
> > +        assertEquals("fooba",
> StringUtils.newStringUsAscii(Base64.decodeBase64("Zm9vYmE=" +
> Base64.CHUNK_SEPARATOR)));
> > +        //assertEquals("foobar",
> StringUtils.newStringUsAscii(Base64.decodeBase64("Zm9vYmFy" +
> Base64.CHUNK_SEPARATOR)));
> > +    }
> > +
> 
> 
> 
> --
> yours,
> 
> Julius Davies
> 250-592-2284 (Home)
> 250-893-4579 (Mobile)
> 
> $ sudo apt-get install cowsay
> $ echo "Moo." | cowsay | cowsay -n | cowsay -n
> http://juliusdavies.ca/cowsay/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org


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


RE: svn commit: r928129 - /commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64Test.java

Posted by Gary Gregory <GG...@seagullsoftware.com>.
Fixed in SVN. Thank you Julius.

Gary Gregory
Senior Software Engineer
Seagull Software
email: ggregory@seagullsoftware.com
email: ggregory@apache.org
www.seagullsoftware.com 



> -----Original Message-----
> From: Julius Davies [mailto:juliusdavies@gmail.com]
> Sent: Friday, March 26, 2010 22:22
> To: dev@commons.apache.org
> Subject: Re: svn commit: r928129 -
> /commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Ba
> se64Test.java
> 
> Hi,
> 
> I think there's a mistake here (even though it's commented out):
> 
> //assertEquals("foo",
> StringUtils.newStringUsAscii(Base64.decodeBase64("Zm9v" +
> Base64.CHUNK_SEPARATOR)));
> 
> 
> Consider output of following:
> 
>         String s = "Zm9v" + Base64.CHUNK_SEPARATOR;
>         System.out.println(s);
> 
> The output is:
> 
>         Zm9v[B@6bbc4459
> 
> 
> I've attached a fix to CODEC-99 as 'codec-99-test-fixes.patch'.
> 
> 
> yours,
> 
> Julius
> 
> 
> > +    public void testRfc4648Section10DecodeWithCrLf() {
> > +        assertEquals("",
> StringUtils.newStringUsAscii(Base64.decodeBase64("")));
> > +        assertEquals("f",
> StringUtils.newStringUsAscii(Base64.decodeBase64("Zg==" +
> Base64.CHUNK_SEPARATOR)));
> > +        assertEquals("fo",
> StringUtils.newStringUsAscii(Base64.decodeBase64("Zm8=" +
> Base64.CHUNK_SEPARATOR)));
> > +        //assertEquals("foo",
> StringUtils.newStringUsAscii(Base64.decodeBase64("Zm9v" +
> Base64.CHUNK_SEPARATOR)));
> > +        assertEquals("foob",
> StringUtils.newStringUsAscii(Base64.decodeBase64("Zm9vYg==" +
> Base64.CHUNK_SEPARATOR)));
> > +        assertEquals("fooba",
> StringUtils.newStringUsAscii(Base64.decodeBase64("Zm9vYmE=" +
> Base64.CHUNK_SEPARATOR)));
> > +        //assertEquals("foobar",
> StringUtils.newStringUsAscii(Base64.decodeBase64("Zm9vYmFy" +
> Base64.CHUNK_SEPARATOR)));
> > +    }
> > +
> 
> 
> 
> --
> yours,
> 
> Julius Davies
> 250-592-2284 (Home)
> 250-893-4579 (Mobile)
> 
> $ sudo apt-get install cowsay
> $ echo "Moo." | cowsay | cowsay -n | cowsay -n
> http://juliusdavies.ca/cowsay/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org


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