@Test public void testDefaultGcpTempLocationInvalid() throws Exception { GcpOptions options = PipelineOptionsFactory.as(GcpOptions.class); options.setTempLocation("file://"); thrown.expect(IllegalArgumentException.class); thrown.expectMessage( "Error constructing default value for gcpTempLocation: tempLocation is not" + " a valid GCS path"); options.getGcpTempLocation(); }
@Test public void testDefaultGcpTempLocationDoesNotExist() { GcpOptions options = PipelineOptionsFactory.as(GcpOptions.class); String tempLocation = "gs://does/not/exist"; options.setTempLocation(tempLocation); thrown.expect(IllegalArgumentException.class); thrown.expectMessage( "Error constructing default value for gcpTempLocation: tempLocation is not" + " a valid GCS path"); thrown.expectCause( hasMessage(containsString("Output path does not exist or is not writeable"))); options.getGcpTempLocation(); }
@Test public void testDefaultGcpTempLocation() throws Exception { GcpOptions options = PipelineOptionsFactory.as(GcpOptions.class); String tempLocation = "gs://bucket"; options.setTempLocation(tempLocation); options.as(GcsOptions.class).setPathValidatorClass(NoopPathValidator.class); assertEquals(tempLocation, options.getGcpTempLocation()); }