@Test
  public void testScanConfigCreation() throws IOException {
    WebSecurityScannerSettings wssSetting = getWssSettingWithCredentials();
    final String formattedParent = ProjectName.format(OUT_VPCSC_PROJECT);
    try (WebSecurityScannerClient wssClient = WebSecurityScannerClient.create(wssSetting)) {
      ScanConfig scanConfig =
          ScanConfig.newBuilder()
              .addAllStartingUrls(Lists.newArrayList(OUT_VPCSC_HOSTNAME))
              .setDisplayName(testScanConfigCreationDisplayName)
              .build();
      CreateScanConfigRequest request =
          CreateScanConfigRequest.newBuilder()
              .setParent(formattedParent)
              .setScanConfig(scanConfig)
              .build();

      ScanConfig responseScanConfig = wssClient.createScanConfig(request);
      fail("Exception must occur for non-accessible project");
    } catch (PermissionDeniedException expected) {
    }
  }
Negative Integration tests for VPC-SC.
java-websecurityscanner/google-cloud-websecurityscanner/src/test/java/com/google/cloud/websecurityscanner/it/v1beta/VPCServiceControlNegativeTest.java