### Question:
SchemaUtils { @SuppressWarnings("unchecked") public static List<String> getAllSchemaList() { List<String> schemaDirList = new ArrayList<>(); File[] schemaDirArr = FileUtils.getAllDir("sql/upgrade"); if (schemaDirArr == null || schemaDirArr.length == 0) { return null; } for (File file : schemaDirArr) { schemaDirList.add(file.getName()); } Collections.sort(schemaDirList, new Comparator() { @Override public int compare(Object o1, Object o2) { try { String dir1 = String.valueOf(o1); String dir2 = String.valueOf(o2); String version1 = dir1.split("_")[0]; String version2 = dir2.split("_")[0]; if (version1.equals(version2)) { return 0; } if (SchemaUtils.isAGreatVersion(version1, version2)) { return 1; } return -1; } catch (Exception e) { logger.error(e.getMessage(), e); throw new RuntimeException(e); } } }); return schemaDirList; } private  SchemaUtils(); @SuppressWarnings("unchecked") static List<String> getAllSchemaList(); static boolean isAGreatVersion(String schemaVersion, String version); static String getSoftVersion(); static String replaceBlank(String str);  }### Answer:
@Test public void testGetAllSchemaList() { PowerMockito.mockStatic(FileUtils.class); File[] files = new File[4]; files[0] = new File("sql/upgrade/1.2.0_schema"); files[1] = new File("sql/upgrade/1.0.1_schema"); files[2] = new File("sql/upgrade/1.0.2_schema"); files[3] = new File("sql/upgrade/1.1.0_schema"); PowerMockito.when(FileUtils.getAllDir("sql/upgrade")).thenReturn(files); List<String> real = SchemaUtils.getAllSchemaList(); List<String> expect = Arrays.asList("1.0.1_schema", "1.0.2_schema", "1.1.0_schema", "1.2.0_schema"); Assert.assertTrue(CollectionUtils.isEqualCollection(real, expect)); files = new File[0]; PowerMockito.when(FileUtils.getAllDir("sql/upgrade")).thenReturn(files); real = SchemaUtils.getAllSchemaList(); Assert.assertNull(real); }