MLUtils { public static String getDate() { DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss"); Date date = new Date(); return dateFormat.format(date); }  static SamplePoints getSample(String path, String dataType, int sampleSize, boolean containsHeader); static String getFirstLine(String filePath); static SamplePoints getSampleFromDAS(String path, int sampleSize, String sourceType, int tenantId); static JavaRDD<String> getLinesFromDASTable(String tableName, int tenantId, JavaSparkContext sparkContext); static String extractTableSchema(String path, int tenantId); static String extractHeaderLine(String path, int tenantId); static List<Integer> getImputeFeatureIndices(Workflow workflow, List<Integer> newToOldIndicesList,
                                                        String imputeOption); static int getFeatureIndex(String feature, String headerRow, String columnSeparator); static int getFeatureIndex(String featureName, List<Feature> features); static SortedMap<Integer, String> getIncludedFeaturesAfterReordering(Workflow workflow,
                                                                                List<Integer> newToOldIndicesList, int responseIndex); static SortedMap<Integer, String> getIncludedFeatures(Workflow workflow, int responseIndex); static MLDatasetVersion getMLDatsetVersion(int tenantId, long datasetId, String userName, String name,
                                                      String version, String targetPath); static String getDate(); static Properties getProperties(List<MLProperty> mlProperties); static double[] toDoubleArray(String[] inArray); static Map<String, Integer> generateHeaderMap(int numberOfFeatures); static Map<String, Integer> generateHeaderMap(String line, CSVFormat format); static int getFeatureSize(String line, CSVFormat format); static String[] getFeatures(String line, CSVFormat format); static JavaRDD<String[]> filterRows(String delimiter, String headerRow, JavaRDD<String> lines,
                                               List<Integer> featureIndices); static String getErrorMsg(String customMessage, Exception ex); static T getKeyByValue(Map<T, E> map, E value); static String arrayToCsvString(String[] array, char delimiter); static Pattern getPatternFromDelimiter(String delimiter); static boolean isValidName(String file);  }
@Test public void getDate() { String date = MLUtils.getDate(); Assert.assertEquals(date.contains("-"), true); Assert.assertEquals(date.contains("_"), true); Assert.assertEquals(!date.contains(":"), true); }