11/*
22 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
33 *
4- * Copyright (c) 2012-2013 Oracle and/or its affiliates. All rights reserved.
4+ * Copyright (c) 2012-2015 Oracle and/or its affiliates. All rights reserved.
55 *
66 * The contents of this file are subject to the terms of either the GNU
77 * General Public License Version 2 only ("GPL") or the Common Development
4949import org .glassfish .jersey .test .JerseyTest ;
5050
5151import org .junit .Test ;
52-
5352import static org .junit .Assert .assertFalse ;
5453import static org .junit .Assert .fail ;
5554
@@ -81,15 +80,14 @@ protected Application configure() {
8180 return new ResourceConfig (SimpleResource .class );
8281 }
8382
84-
8583 @ Test
8684 public void testReadAfterClose () {
8785 final Response response = target ().path ("simple" ).request ().get (Response .class );
8886 response .close ();
8987 try {
9088 response .readEntity (String .class );
9189 fail ("IllegalStateException expected when reading entity after response has been closed." );
92- } catch (IllegalStateException ex ) {
90+ } catch (final IllegalStateException ex ) {
9391 // expected
9492 }
9593 }
@@ -101,7 +99,7 @@ public void testCloseBeforeReadingEmptyContentHasNoEffect() {
10199 try {
102100 response .readEntity (String .class );
103101 fail ("IllegalStateException expected when reading entity after response has been closed." );
104- } catch (IllegalStateException ex ) {
102+ } catch (final IllegalStateException ex ) {
105103 // expected
106104 }
107105 }
@@ -115,7 +113,7 @@ public void testReadAfterMultipleClose() {
115113 try {
116114 response .readEntity (String .class );
117115 fail ("IllegalStateException expected when reading entity after response has been closed." );
118- } catch (IllegalStateException ex ) {
116+ } catch (final IllegalStateException ex ) {
119117 // expected
120118 }
121119 }
@@ -128,7 +126,7 @@ public void testReadBufferedEntityAfterClose() {
128126 try {
129127 response .readEntity (String .class );
130128 fail ("IllegalStateException expected when reading a buffered entity after response has been closed." );
131- } catch (IllegalStateException ex ) {
129+ } catch (final IllegalStateException ex ) {
132130 // expected
133131 }
134132 }
@@ -140,7 +138,7 @@ public void testBufferEntityAfterClose() {
140138 try {
141139 response .bufferEntity ();
142140 fail ("IllegalStateException expected when reading a buffered entity after response has been closed." );
143- } catch (IllegalStateException ex ) {
141+ } catch (final IllegalStateException ex ) {
144142 // expected
145143 }
146144 }
@@ -152,7 +150,7 @@ public void testGetEntityAfterClose() {
152150 try {
153151 response .getEntity ();
154152 fail ("IllegalStateException expected when reading a buffered entity after response has been closed." );
155- } catch (IllegalStateException ex ) {
153+ } catch (final IllegalStateException ex ) {
156154 // expected
157155 }
158156 }
@@ -162,9 +160,9 @@ public void testHasEntityAfterClose() {
162160 final Response response = target ().path ("simple" ).request ().get (Response .class );
163161 response .close ();
164162 try {
165- boolean hasEntity = response .hasEntity ();
163+ final boolean hasEntity = response .hasEntity ();
166164 assertFalse ("Should return false when the connection is already closed" , hasEntity );
167- } catch (IllegalStateException ex ) {
165+ } catch (final IllegalStateException ex ) {
168166 fail ("IllegalStateException should have been caught inside hasEntity." );
169167 }
170168 }
0 commit comments