@@ -0,0 +1,2525 @@
+/**%0A * Copyright (c) 2016, German Neuroinformatics Node (G-Node)%0A *%0A * All rights reserved.%0A *%0A * Redistribution and use in source and binary forms, with or without%0A * modification, are permitted under the terms of the BSD License. See%0A * LICENSE file in the root of the Project.%0A */%0A%0Apackage org.g_node.srv;%0A%0Aimport java.io.File;%0Aimport java.nio.file.Files;%0Aimport java.nio.file.Path;%0Aimport java.nio.file.Paths;%0Aimport org.apache.commons.io.FileUtils;%0Aimport static org.assertj.core.api.Assertions.assertThat;%0Aimport org.junit.After;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0A/**%0A * Unit tests for the %7B@link CtrlCheckService%7D class.%0A *%0A * @author Michael Sonntag (sonntag@bio.lmu.de)%0A */%0Apublic class CtrlCheckServiceTest %7B%0A%0A    private final String tmpRoot = System.getProperty(%22java.io.tmpdir%22);%0A    private final String testFolderName = %22ctrlCheckServiceTest%22;%0A    private final String testFileName = %22test.txt%22;%0A    private final Path testFileFolder = Paths.get(tmpRoot, testFolderName);%0A%0A    /**%0A     * Create a test folder and the main test file in the java temp directory.%0A     * @throws Exception%0A     */%0A    @Before%0A    public void setUp() throws Exception %7B%0A        final File currTestFile = this.testFileFolder.resolve(this.testFileName).toFile();%0A        FileUtils.write(currTestFile, %22This is a normal test file%22);%0A    %7D%0A%0A    /**%0A     * Remove all created folders and files after the tests are done.%0A     * @throws Exception%0A     */%0A    @After%0A    public void tearDown() throws Exception %7B%0A        if (Files.exists(this.testFileFolder)) %7B%0A            FileUtils.deleteDirectory(this.testFileFolder.toFile());%0A        %7D%0A    %7D%0A%0A    /**%0A     * Test if the method returns false when presented with a%0A     * String referencing a non existing file and returns true if it is%0A     * presented with String referencing an existing file.%0A     * @throws Exception%0A     */%0A    @Test%0A    public void testExistingFile() throws Exception %7B%0A        final String testNonExistingFilePath =%0A                this.testFileFolder%0A                        .resolve(%22IdoNotExist%22)%0A                        .toAbsolutePath().normalize().toString();%0A%0A        assertThat(CtrlCheckService.isExistingFile(testNonExistingFilePath)).isFalse();%0A%0A        final String testExistingFilePath =%0A                this.testFileFolder%0A                        .resolve(this.testFileName)%0A                        .toAbsolutePath().normalize().toString();%0A%0A        assertThat(CtrlCheckService.isExistingFile(testExistingFilePath)).isTrue();%0A    %7D%0A%0A%7D%0A

Add CtrlCheckService tests