@Test public void testAddFileExtension() { for (VectorGraphicsFormat format : VectorGraphicsFormat.values()) { Assert.assertEquals( String.format("test.%s", format.toString().toLowerCase()), VectorGraphicsEncoder.addFileExtension("test", format)); Assert.assertEquals( String.format("test.%s", format.toString().toLowerCase()), VectorGraphicsEncoder.addFileExtension( String.format("test.%s", format.toString().toLowerCase()), format)); Assert.assertEquals( String.format("test.%1$s%1$s.%1$s", format.toString().toLowerCase()), VectorGraphicsEncoder.addFileExtension( String.format("test.%1$s%1$s", format.toString().toLowerCase()), format)); Assert.assertEquals( String.format("test.%1$s.%1$s", format.toString().toLowerCase()), VectorGraphicsEncoder.addFileExtension( String.format("test.%1$s.%1$s", format.toString().toLowerCase()), format)); Assert.assertEquals( String.format("test.txt.%1$s", format.toString().toLowerCase()), VectorGraphicsEncoder.addFileExtension("test.txt", format)); } }
public static String addFileExtension( String fileName, VectorGraphicsFormat vectorGraphicsFormat) { String fileNameWithFileExtension = fileName; final String newFileExtension = "." + vectorGraphicsFormat.toString().toLowerCase(); if (fileName.length() <= newFileExtension.length() || !fileName .substring(fileName.length() - newFileExtension.length(), fileName.length()) .equalsIgnoreCase(newFileExtension)) { fileNameWithFileExtension = fileName + newFileExtension; } return fileNameWithFileExtension; }
VectorGraphicsEncoder { public static String addFileExtension( String fileName, VectorGraphicsFormat vectorGraphicsFormat) { String fileNameWithFileExtension = fileName; final String newFileExtension = "." + vectorGraphicsFormat.toString().toLowerCase(); if (fileName.length() <= newFileExtension.length() || !fileName .substring(fileName.length() - newFileExtension.length(), fileName.length()) .equalsIgnoreCase(newFileExtension)) { fileNameWithFileExtension = fileName + newFileExtension; } return fileNameWithFileExtension; } }
VectorGraphicsEncoder { public static String addFileExtension( String fileName, VectorGraphicsFormat vectorGraphicsFormat) { String fileNameWithFileExtension = fileName; final String newFileExtension = "." + vectorGraphicsFormat.toString().toLowerCase(); if (fileName.length() <= newFileExtension.length() || !fileName .substring(fileName.length() - newFileExtension.length(), fileName.length()) .equalsIgnoreCase(newFileExtension)) { fileNameWithFileExtension = fileName + newFileExtension; } return fileNameWithFileExtension; } private  VectorGraphicsEncoder(); }
VectorGraphicsEncoder { public static String addFileExtension( String fileName, VectorGraphicsFormat vectorGraphicsFormat) { String fileNameWithFileExtension = fileName; final String newFileExtension = "." + vectorGraphicsFormat.toString().toLowerCase(); if (fileName.length() <= newFileExtension.length() || !fileName .substring(fileName.length() - newFileExtension.length(), fileName.length()) .equalsIgnoreCase(newFileExtension)) { fileNameWithFileExtension = fileName + newFileExtension; } return fileNameWithFileExtension; } private  VectorGraphicsEncoder(); static void saveVectorGraphic(
      Chart chart, String fileName, VectorGraphicsFormat vectorGraphicsFormat); static void saveVectorGraphic(
      Chart chart, OutputStream os, VectorGraphicsFormat vectorGraphicsFormat); static String addFileExtension(
      String fileName, VectorGraphicsFormat vectorGraphicsFormat); }
VectorGraphicsEncoder { public static String addFileExtension( String fileName, VectorGraphicsFormat vectorGraphicsFormat) { String fileNameWithFileExtension = fileName; final String newFileExtension = "." + vectorGraphicsFormat.toString().toLowerCase(); if (fileName.length() <= newFileExtension.length() || !fileName .substring(fileName.length() - newFileExtension.length(), fileName.length()) .equalsIgnoreCase(newFileExtension)) { fileNameWithFileExtension = fileName + newFileExtension; } return fileNameWithFileExtension; } private  VectorGraphicsEncoder(); static void saveVectorGraphic(
      Chart chart, String fileName, VectorGraphicsFormat vectorGraphicsFormat); static void saveVectorGraphic(
      Chart chart, OutputStream os, VectorGraphicsFormat vectorGraphicsFormat); static String addFileExtension(
      String fileName, VectorGraphicsFormat vectorGraphicsFormat);  }