99import java .net .UnknownHostException ;
1010import java .util .Map ;
1111
12- import static org .junit .Assert .* ;
12+ import static org .junit .Assert .assertEquals ;
1313
1414import org .junit .After ;
1515import org .junit .Before ;
1616import org .junit .Test ;
1717
1818
1919public class EdgeAuthTest {
20- private static long DEFAULT_WINDOW_SECONDS = 500L ;
20+ private static final long DEFAULT_WINDOW_SECONDS = 500L ;
2121
2222 private EdgeAuth ea ;
2323 private EdgeAuth cea ;
@@ -108,13 +108,13 @@ private static String requests(String hostname, String path, String qs, String h
108108 sb .append ("Host: " );
109109 sb .append (hostname );
110110 sb .append ("\r \n " );
111- if (header != null && header != "" ) {
111+ if (header != null && ! header . isEmpty () ) {
112112 sb .append (header );
113113 sb .append ("\r \n " );
114114 }
115115 sb .append ("\r \n " );
116116
117- request .print (sb . toString () );
117+ request .print (sb );
118118 request .flush ();
119119
120120 InputStream inStream = socket .getInputStream ();
@@ -137,13 +137,13 @@ private static String requests(String hostname, String path, String qs, String h
137137 return statusCode ;
138138 }
139139
140- private void queryAssertEqual (String path , String expacted , boolean escapeEarly , boolean transition , String payload , String sessionId , boolean isUrl ) throws EdgeAuthException , UnknownHostException , IOException {
140+ private void queryAssertEqual (String path , String expected , boolean escapeEarly , boolean transition , String payload , String sessionId , boolean isUrl ) throws EdgeAuthException , UnknownHostException , IOException {
141141 this .tokenSetting ('q' , escapeEarly , transition );
142142
143143 ea .setPayload (payload );
144144 ea .setSessionId (sessionId );
145145
146- String token = "" ;
146+ String token ;
147147 if (isUrl ) {
148148 token = this .ea .generateURLToken (path );
149149 } else {
@@ -152,16 +152,16 @@ private void queryAssertEqual(String path, String expacted, boolean escapeEarly,
152152
153153 String qs = this .ea .getTokenName () + "=" + token ;
154154 String statusCode = EdgeAuthTest .requests (this .eaHostname , path , qs , null );
155- assertEquals (expacted , statusCode );
155+ assertEquals (expected , statusCode );
156156 }
157157
158- private void cookieAssertEqual (String path , String expacted , boolean escapeEarly , boolean transition , String payload , String sessionId , boolean isUrl ) throws EdgeAuthException , UnknownHostException , IOException {
158+ private void cookieAssertEqual (String path , String expected , boolean escapeEarly , boolean transition , String payload , String sessionId , boolean isUrl ) throws EdgeAuthException , UnknownHostException , IOException {
159159 this .tokenSetting ('c' , escapeEarly , transition );
160160
161161 cea .setPayload (payload );
162162 cea .setSessionId (sessionId );
163163
164- String token = "" ;
164+ String token ;
165165 if (isUrl ) {
166166 token = this .cea .generateURLToken (path );
167167 } else {
@@ -170,16 +170,16 @@ private void cookieAssertEqual(String path, String expacted, boolean escapeEarly
170170
171171 String cookie = "Cookie: " + this .cea .getTokenName () + "=" + token ;
172172 String statusCode = EdgeAuthTest .requests (this .eaHostname , path , null , cookie );
173- assertEquals (expacted , statusCode );
173+ assertEquals (expected , statusCode );
174174 }
175175
176- private void headerAssertEqual (String path , String expacted , boolean escapeEarly , boolean transition , String payload , String sessionId , boolean isUrl ) throws EdgeAuthException , UnknownHostException , IOException {
176+ private void headerAssertEqual (String path , String expected , boolean escapeEarly , boolean transition , String payload , String sessionId , boolean isUrl ) throws EdgeAuthException , UnknownHostException , IOException {
177177 this .tokenSetting ('h' , escapeEarly , transition );
178178
179179 hea .setPayload (payload );
180180 hea .setSessionId (sessionId );
181181
182- String token = "" ;
182+ String token ;
183183 if (isUrl ) {
184184 token = this .hea .generateURLToken (path );
185185 } else {
@@ -188,7 +188,7 @@ private void headerAssertEqual(String path, String expacted, boolean escapeEarly
188188
189189 String header = this .hea .getTokenName () + ":" + token ;
190190 String statusCode = EdgeAuthTest .requests (this .eaHostname , path , null , header );
191- assertEquals (expacted , statusCode );
191+ assertEquals (expected , statusCode );
192192 }
193193
194194 private void testCaseSet (String queryPath , String cookiePath , String headerPath , boolean escapeEarly , boolean isUrl ) throws UnknownHostException , EdgeAuthException , IOException {
@@ -309,7 +309,7 @@ public void test_acl_deli_escape_on__ignoreQuery_yes() throws UnknownHostExcepti
309309 .key (this .eaEncryptionKey )
310310 .windowSeconds (EdgeAuthTest .DEFAULT_WINDOW_SECONDS )
311311 .build ();
312- String acl [] = { "/q_escape_ignore" , "/q_escape_ignore/*" };
312+ String [] acl = { "/q_escape_ignore" , "/q_escape_ignore/*" };
313313
314314 // For Java 8=
315315 // String token = ead.generateACLToken(String.join(EdgeAuth.ACL_DELIMITER, acl));
0 commit comments