This is the codeAbility Sharing Platform! Learn more about the codeAbility Sharing Platform.

Skip to content
Snippets Groups Projects
Commit ccdeea84 authored by Daniel Crazzolara's avatar Daniel Crazzolara
Browse files

Fixed failing tests

parent bc63515a
Branches
2 merge requests!71Merge for September Release,!70Improvement/adapt import to new artemis export
......@@ -312,9 +312,13 @@ public class ExerciseService {
* @param exerciseToken to retrieve the location of the files to rename
*/
private void renameFiles(String exerciseToken) {
File problemStatementFile = Objects.requireNonNull(new File("tmp-import", exerciseToken).listFiles((file, name) -> name.startsWith("Problem-Statement-") && name.endsWith(".md")))[0];
if (!problemStatementFile.renameTo(new File("tmp-import" + File.separator + exerciseToken, "exercise.md"))) {
log.warn("Unable to rename file [{}]. Skipping..", problemStatementFile.getName());
try {
File problemStatementFile = Objects.requireNonNull(new File("tmp-import", exerciseToken).listFiles((file, name) -> name.startsWith("Problem-Statement-") && name.endsWith(".md")))[0];
if (!problemStatementFile.renameTo(new File("tmp-import" + File.separator + exerciseToken, "exercise.md"))) {
log.error("Unable to rename file [{}]. Skipping..", problemStatementFile.getName());
}
} catch (ArrayIndexOutOfBoundsException e) {
log.error("File to rename could not be found in [{}].", "tmp-import" + File.separator + exerciseToken);
}
}
......
......@@ -96,7 +96,7 @@ public class ExerciseServiceIT {
@Test
public void testApplyExerciseInfoChanges() throws Exception {
File metadata = new File("tmp-import/" + token, "Exercise-Details-something.json");
File metadata = new File("tmp-import/" + token, "metadata.yaml");
metadata.getParentFile().mkdirs();
metadata.createNewFile();
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment