test_class.file: gcsio/src/test/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageStringsTest.java
test_class.identifier: GoogleCloudStorageStringsTest
test_case.body: @Test
    public void testMatchListPrefixIllegalArguments() {
      String[][] invalidArgs = {
        {"my-prefix", null},
        {"my-prefix", ""},
        // Even if prefix is null, the argument-check should throw.
        {null, null},
        {null, ""},
      };
  
      for (String[] args : invalidArgs) {
        IllegalArgumentException iae =
            assertThrows(
                IllegalArgumentException.class,
                () ->
                    GoogleCloudStorageStrings.matchListPrefix(
                        args[0], args[1], ListObjectOptions.DEFAULT));
        assertThat(iae).hasMessageThat().matches(".*objectName.*");
      }
    }
test_case.class_method_signature: GoogleCloudStorageStringsTest.testMatchListPrefixIllegalArguments()
test_case.full_signature: @Test public void testMatchListPrefixIllegalArguments()
test_case.identifier: testMatchListPrefixIllegalArguments
test_case.invocations: assertThrows matchListPrefix matches hasMessageThat assertThat
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testMatchListPrefixIllegalArguments()
focal_class.file: gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageStrings.java
focal_class.identifier: GoogleCloudStorageStrings
focal_class.class_method_signature: GoogleCloudStorageStrings.matchListPrefix(
        String objectNamePrefix, String objectName, ListObjectOptions listOptions)
focal_class.full_signature: public static String matchListPrefix(
        String objectNamePrefix, String objectName, ListObjectOptions listOptions)
focal_class.identifier: matchListPrefix
focal_class.modifiers: public static
focal_class.parameters: (
        String objectNamePrefix, String objectName, ListObjectOptions listOptions)
focal_class.return: String
focal_class.signature: String matchListPrefix(
        String objectNamePrefix, String objectName, ListObjectOptions listOptions)
focal_method.body: public static String matchListPrefix(
        String objectNamePrefix, String objectName, ListObjectOptions listOptions) {
      checkArgument(
          !isNullOrEmpty(objectName),
          "matchListPrefix(%s, %s, %s): objectName must not be null or empty.",
          objectNamePrefix,
          objectName,
          listOptions);
  
      // The suffix that we'll use to check for the delimiter is just the whole name if no prefix
      // was supplied.
      String suffix = objectName;
      int suffixIndex = 0;
      if (objectNamePrefix != null) {
        // The underlying GCS API does return objectName when it equals the prefix, but our
        // GoogleCloudStorage wrapper filters this case if the objectName also ends with
        // PATH_DELIMITER.
        if (!objectName.startsWith(objectNamePrefix)
            || (objectName.equals(objectNamePrefix)
                && objectNamePrefix.endsWith(PATH_DELIMITER)
                && !listOptions.isIncludePrefix())) {
          return null;
        }
        suffixIndex = objectNamePrefix.length();
        suffix = objectName.substring(suffixIndex);
      }
  
      String delimiter = listOptions.getDelimiter();
      return !isNullOrEmpty(delimiter) && suffix.contains(delimiter)
          // Return the full prefix and suffix up through first occurrence of delimiter after
          // the prefix, inclusive of the delimiter.
          ? objectName.substring(0, objectName.indexOf(delimiter, suffixIndex) + delimiter.length())
          : objectName;
    }
focal_method.class_method_signature: GoogleCloudStorageStrings.matchListPrefix(
        String objectNamePrefix, String objectName, ListObjectOptions listOptions)
focal_method.full_signature: public static String matchListPrefix(
        String objectNamePrefix, String objectName, ListObjectOptions listOptions)
focal_method.identifier: matchListPrefix
focal_method.invocations: checkArgument isNullOrEmpty startsWith equals endsWith isIncludePrefix length substring getDelimiter isNullOrEmpty contains substring indexOf length
focal_method.modifiers: public static
focal_method.parameters: (
        String objectNamePrefix, String objectName, ListObjectOptions listOptions)
focal_method.return: String
focal_method.signature: String matchListPrefix(
        String objectNamePrefix, String objectName, ListObjectOptions listOptions)