@Test public void getAdjustedFilenameForKeys() { List<String> expectedFilenames = new ArrayList<>(Arrays.asList( "x.keys.avro", "asdf.keys.avro", "keys.keys.avro", "key.keys.avro", "headers.keys.avro", "header.keys.avro", "sample-filename.keys.avro", "sample.filename.keys.avro", "sample.file.name.keys.avro" )); for (int i = 0; i < expectedFilenames.size(); i++) { String adjustedFilename = getAdjustedFilename(new KeyRecordView(), givenFilenames.get(i), ".avro"); assertEquals(expectedFilenames.get(i), adjustedFilename); } }
public static String getAdjustedFilename(RecordView recordView, String filename, String initialExtension) { if (filename.endsWith(initialExtension)) { int index = filename.indexOf(initialExtension); return filename.substring(0, index) + recordView.getExtension() + initialExtension; } else { return filename + recordView.getExtension() + initialExtension; } }
Utils { public static String getAdjustedFilename(RecordView recordView, String filename, String initialExtension) { if (filename.endsWith(initialExtension)) { int index = filename.indexOf(initialExtension); return filename.substring(0, index) + recordView.getExtension() + initialExtension; } else { return filename + recordView.getExtension() + initialExtension; } } }
Utils { public static String getAdjustedFilename(RecordView recordView, String filename, String initialExtension) { if (filename.endsWith(initialExtension)) { int index = filename.indexOf(initialExtension); return filename.substring(0, index) + recordView.getExtension() + initialExtension; } else { return filename + recordView.getExtension() + initialExtension; } }  }
Utils { public static String getAdjustedFilename(RecordView recordView, String filename, String initialExtension) { if (filename.endsWith(initialExtension)) { int index = filename.indexOf(initialExtension); return filename.substring(0, index) + recordView.getExtension() + initialExtension; } else { return filename + recordView.getExtension() + initialExtension; } }  static String getAdjustedFilename(RecordView recordView, String filename,
      String initialExtension); }
Utils { public static String getAdjustedFilename(RecordView recordView, String filename, String initialExtension) { if (filename.endsWith(initialExtension)) { int index = filename.indexOf(initialExtension); return filename.substring(0, index) + recordView.getExtension() + initialExtension; } else { return filename + recordView.getExtension() + initialExtension; } }  static String getAdjustedFilename(RecordView recordView, String filename,
      String initialExtension);  }