ConfigFileUtils { static void checkFormat(final String originalFilename) { final List<String> fileNameSplit = Splitter.on(".").splitToList(originalFilename); if (fileNameSplit.size() <= 1) { throw new BadRequestException("The file format is invalid."); } for (String s : fileNameSplit) { if (StringUtils.isEmpty(s)) { throw new BadRequestException("The file format is invalid."); } } }  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 checkFormat() { ConfigFileUtils.checkFormat("1234+default+app.properties"); ConfigFileUtils.checkFormat("1234+default+app.yml"); ConfigFileUtils.checkFormat("1234+default+app.json"); }
@Test(expected = BadRequestException.class) public void checkFormatWithException0() { ConfigFileUtils.checkFormat("1234+defaultes"); }
@Test(expected = BadRequestException.class) public void checkFormatWithException1() { ConfigFileUtils.checkFormat(".json"); }
@Test(expected = BadRequestException.class) public void checkFormatWithException2() { ConfigFileUtils.checkFormat("application."); }