### Question:
FilenameVariantConverter { public String toVariantFileName(String fileName, String variant) { if (variant==null || variant.isEmpty()) { return fileName; } if (fileName == null) { throw new IllegalArgumentException("filename may not be null!"); } int index = fileName.indexOf('.'); if (index == -1) { throw new IllegalArgumentException("no '.' found, so not able to create variant file name!"); } String postfix = fileName.substring(index); String prefix = fileName.substring(0, index); return prefix + variantIdentifier + variant + postfix; } FilenameVariantConverter();  FilenameVariantConverter(String varIdentifier); String getVariantFromFilename(String fileName); String toVariantFileName(String fileName, String variant); String getFilenameWithoutVariant(String fileName); static final String DEFAULT_IDENTIFIER; }### Answer:
@Test public void filename_test_to_variantfilename_variant_is_variant1() { assertEquals("filename1-variant_variant1.txt",converterToTest.toVariantFileName("filename1.txt","variant1")); }
@Test public void filename_test_to_variantfilename_variant_is_null() { assertEquals("filename1.txt",converterToTest.toVariantFileName("filename1.txt",null)); }
@Test public void filename_test_to_variantfilename_variant_is_empty() { assertEquals("filename1.txt",converterToTest.toVariantFileName("filename1.txt","")); }