ConfigFileUtils { public static String getNamespace(final String originalFilename) { checkThreePart(originalFilename); final String[] threeParts = getThreePart(originalFilename); final String suffix = threeParts[2]; if (!suffix.contains(".")) { throw new BadRequestException(originalFilename + " namespace and format is invalid!"); } final int lastDotIndex = suffix.lastIndexOf("."); final String namespace = suffix.substring(0, lastDotIndex); final String format = suffix.substring(lastDotIndex + 1); if (!ConfigFileFormat.isValidFormat(format)) { throw new BadRequestException(originalFilename + " format is invalid!"); } ConfigFileFormat configFileFormat = ConfigFileFormat.fromString(format); if (configFileFormat.equals(ConfigFileFormat.Properties)) { return namespace; } else { return namespace + "." + format; } }  static void check(MultipartFile file); static String getFormat(final String originalFilename); static String getAppId(final String originalFilename); static String getClusterName(final String originalFilename); static String getNamespace(final String originalFilename); static String toFilename(
      final String appId,
      final String clusterName,
      final String namespace,
      final ConfigFileFormat configFileFormat
  ); static String toFilePath(
      final String ownerName,
      final String appId,
      final Env env,
      final String configFilename
  );  }
@Test public void getNamespace() { final String application = ConfigFileUtils.getNamespace("234+default+application.properties"); assertEquals("application", application); final String applicationYml = ConfigFileUtils.getNamespace("abc+default+application.yml"); assertEquals("application.yml", applicationYml); }