@@ -15,9 +15,10 @@ public class Java8EncodeDecodeTest {
1515 // tests
1616
1717 @ Test
18- public void whenStringIsEncoded () throws UnsupportedEncodingException {
18+ public void whenStringIsEncoded_thenOk () throws UnsupportedEncodingException {
1919 final String originalInput = "test input" ;
2020 final String encodedString = Base64 .getEncoder ().encodeToString (originalInput .getBytes ());
21+
2122 assertNotNull (encodedString );
2223 assertNotEquals (originalInput , encodedString );
2324 }
@@ -35,9 +36,10 @@ public void whenStringIsEncoded_thenStringCanBeDecoded() throws UnsupportedEncod
3536 }
3637
3738 @ Test
38- public void whenStringIsEncodedWithoutPadding () throws UnsupportedEncodingException {
39+ public void whenStringIsEncodedWithoutPadding_thenOk () throws UnsupportedEncodingException {
3940 final String originalInput = "test input" ;
4041 final String encodedString = Base64 .getEncoder ().withoutPadding ().encodeToString (originalInput .getBytes ());
42+
4143 assertNotNull (encodedString );
4244 assertNotEquals (originalInput , encodedString );
4345 }
@@ -55,25 +57,27 @@ public void whenStringIsEncodedWithoutPadding_thenStringCanBeDecoded() throws Un
5557 }
5658
5759 @ Test
58- public void whenURLIsEncoded () throws UnsupportedEncodingException {
59- final String originalURL = "https://www.google.co.nz/?gfe_rd=cr&ei=dzbFVf&gws_rd=ssl#q=java" ;
60- final String encodedURL = Base64 .getUrlEncoder ().encodeToString (originalURL .getBytes ());
61- assertNotNull (encodedURL );
62- assertNotEquals (originalURL , encodedURL );
60+ public void whenUrlIsEncoded_thenOk () throws UnsupportedEncodingException {
61+ final String originalUrl = "https://www.google.co.nz/?gfe_rd=cr&ei=dzbFVf&gws_rd=ssl#q=java" ;
62+ final String encodedUrl = Base64 .getUrlEncoder ().encodeToString (originalUrl .getBytes ());
63+ assertNotNull (encodedUrl );
64+ assertNotEquals (originalUrl , encodedUrl );
6365 }
6466
6567 @ Test
66- public void whenURLIsEncoded_thenURLCanBeDecoded () throws UnsupportedEncodingException {
67- final String originalURL = "https://www.google.co.nz/?gfe_rd=cr&ei=dzbFVf&gws_rd=ssl#q=java" ;
68- final String encodedURL = Base64 .getUrlEncoder ().encodeToString (originalURL .getBytes ());
69- final byte [] decodedBytes = Base64 .getUrlDecoder ().decode (encodedURL .getBytes ());
70- final String decodedURL = new String (decodedBytes );
71- assertNotNull (decodedURL );
72- assertEquals (originalURL , decodedURL );
68+ public void whenUrlIsEncoded_thenURLCanBeDecoded () throws UnsupportedEncodingException {
69+ final String originalUrl = "https://www.google.co.nz/?gfe_rd=cr&ei=dzbFVf&gws_rd=ssl#q=java" ;
70+ final String encodedUrl = Base64 .getUrlEncoder ().encodeToString (originalUrl .getBytes ());
71+
72+ final byte [] decodedBytes = Base64 .getUrlDecoder ().decode (encodedUrl .getBytes ());
73+ final String decodedUrl = new String (decodedBytes );
74+
75+ assertNotNull (decodedUrl );
76+ assertEquals (originalUrl , decodedUrl );
7377 }
7478
7579 @ Test
76- public void whenMIMEIsEncoded () throws UnsupportedEncodingException {
80+ public void whenMimeIsEncoded_thenOk () throws UnsupportedEncodingException {
7781 final StringBuilder buffer = getMimeBuffer ();
7882
7983 final byte [] forEncode = buffer .toString ().getBytes ();
@@ -83,7 +87,7 @@ public void whenMIMEIsEncoded() throws UnsupportedEncodingException {
8387 }
8488
8589 @ Test
86- public void whenMIMEIsEncoded_thenMIMECanBeDecoded () throws UnsupportedEncodingException {
90+ public void whenMimeIsEncoded_thenItCanBeDecoded () throws UnsupportedEncodingException {
8791 final StringBuilder buffer = getMimeBuffer ();
8892
8993 final byte [] forEncode = buffer .toString ().getBytes ();
0 commit comments