7575import org .junit .AfterClass ;
7676import org .junit .Assert ;
7777import org .junit .BeforeClass ;
78- import org .junit .Ignore ;
7978import org .junit .Rule ;
8079import org .junit .Test ;
8180import org .junit .runner .RunWith ;
@@ -176,7 +175,6 @@ private static void fillRequesterPaysFile(Storage storage, String fname, int siz
176175
177176 // Start of tests related to the "requester pays" feature
178177 @ Test
179- @ Ignore ("TODO: https://github.com/googleapis/java-storage-nio/issues/824" )
180178 public void testFileExistsRequesterPaysNoUserProject () throws IOException {
181179 CloudStorageFileSystem testBucket = getRequesterPaysBucket (false , "" );
182180 Path path = testBucket .getPath (SML_FILE );
@@ -190,7 +188,6 @@ public void testFileExistsRequesterPaysNoUserProject() throws IOException {
190188 }
191189
192190 @ Test
193- @ Ignore ("TODO: https://github.com/googleapis/java-storage-nio/issues/824" )
194191 public void testFileExistsRequesterPays () throws IOException {
195192 CloudStorageFileSystem testBucket = getRequesterPaysBucket (false , project );
196193 Path path = testBucket .getPath (SML_FILE );
@@ -199,7 +196,6 @@ public void testFileExistsRequesterPays() throws IOException {
199196 }
200197
201198 @ Test
202- @ Ignore ("TODO: https://github.com/googleapis/java-storage-nio/issues/824" )
203199 public void testFileExistsRequesterPaysWithAutodetect () throws IOException {
204200 CloudStorageFileSystem testBucket = getRequesterPaysBucket (true , project );
205201 Path path = testBucket .getPath (SML_FILE );
@@ -208,7 +204,6 @@ public void testFileExistsRequesterPaysWithAutodetect() throws IOException {
208204 }
209205
210206 @ Test
211- @ Ignore ("TODO: https://github.com/googleapis/java-storage-nio/issues/824" )
212207 public void testCantCreateWithoutUserProject () throws IOException {
213208 CloudStorageFileSystem testBucket = getRequesterPaysBucket (false , "" );
214209 Path path = testBucket .getPath (TMP_FILE );
@@ -230,7 +225,6 @@ public void testCanCreateWithUserProject() throws IOException {
230225 }
231226
232227 @ Test
233- @ Ignore ("TODO: https://github.com/googleapis/java-storage-nio/issues/824" )
234228 public void testCantReadWithoutUserProject () throws IOException {
235229 CloudStorageFileSystem testBucket = getRequesterPaysBucket (false , "" );
236230 Path path = testBucket .getPath (SML_FILE );
@@ -252,7 +246,6 @@ public void testCanReadWithUserProject() throws IOException {
252246 }
253247
254248 @ Test
255- @ Ignore ("TODO: https://github.com/googleapis/java-storage-nio/issues/824" )
256249 public void testCantCopyWithoutUserProject () throws IOException {
257250 CloudStorageFileSystem testRPBucket = getRequesterPaysBucket (false , "" );
258251 CloudStorageFileSystem testBucket = getTestBucket ();
@@ -285,10 +278,7 @@ private void innerTestCantCopyWithoutUserProject(
285278 // normal StorageException.
286279 } catch (HttpResponseException hex ) {
287280 Assert .assertEquals (description , hex .getStatusCode (), 400 );
288- Assert .assertTrue (
289- description ,
290- hex .getMessage ()
291- .contains ("Bucket is requester pays bucket but no user project provided" ));
281+ Assert .assertTrue (description , hex .getMessage ().contains ("requester pays" ));
292282 } catch (StorageException ex ) {
293283 assertIsRequesterPaysException (description , ex );
294284 }
@@ -314,7 +304,6 @@ public void testCanCopyWithUserProject() throws IOException {
314304 }
315305
316306 @ Test
317- @ Ignore ("TODO: https://github.com/googleapis/java-storage-nio/issues/824" )
318307 public void testAutodetectWhenRequesterPays () throws IOException {
319308 CloudStorageFileSystem testRPBucket = getRequesterPaysBucket (true , project );
320309 Assert .assertEquals (
@@ -338,18 +327,20 @@ public void testAutodetectWhenNotRequesterPays() throws IOException {
338327 "" );
339328 }
340329
330+ @ Test
331+ public void testAutoDetectNoUserProject () throws IOException {
332+ CloudStorageFileSystem testBucket = getRequesterPaysBucket (false , "" );
333+ Assert .assertTrue (testBucket .provider ().requesterPays (testBucket .bucket ()));
334+ }
335+
341336 private void assertIsRequesterPaysException (String message , StorageException ex ) {
342337 Assert .assertEquals (message , ex .getCode (), 400 );
343- Assert .assertTrue (
344- message ,
345- ex .getMessage ().contains ("Bucket is requester pays bucket but no user project provided" ));
338+ Assert .assertTrue (message , ex .getMessage ().contains ("requester pays" ));
346339 }
347340
348341 private void assertIsRequesterPaysException (String message , IOException ioex ) {
349342 Assert .assertTrue (message , ioex .getMessage ().startsWith ("400" ));
350- Assert .assertTrue (
351- message ,
352- ioex .getMessage ().contains ("Bucket is requester pays bucket but no user project provided" ));
343+ Assert .assertTrue (message , ioex .getMessage ().contains ("requester pays" ));
353344 }
354345 // End of tests related to the "requester pays" feature
355346
0 commit comments