PosterUtils { public static File getMoviePosterFileWithName(File rootPath, String movieName) { movieName = movieName.replaceAll("\\\\", "-"); movieName = movieName.replaceAll(" ", "-"); return new File(rootPath, String.format("%s.jpg", movieName)); }  static File getMoviePosterFileWithName(File rootPath, String movieName); static File getMoviePosterFileWithName(String movieName); static File getMusicFileWithName(String albumName, String musicName, String userName);  }
@Test public void getMoviePosterFileWithName() throws Exception { Assert.assertEquals("C:\\这个--杀手-不-太冷.jgp", PosterUtils.getMoviePosterFileWithName( new File("C:\\"), "这个 \\杀手 不\\太冷").getPath()); }