Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
cherylking committed May 19, 2023
1 parent 819fcb5 commit 260839d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -285,14 +285,13 @@ class BaseDevTest extends AbstractIntegrationTest {
protected static void cleanUpAfterClass(boolean isDevMode) throws Exception {
stopProcess(isDevMode);
if (buildDir != null && buildDir.exists()) {
// FileUtils.deleteDirectory(buildDir);
//FileUtils.deleteQuietly(buildDir); // try this method that does not throw an exception
FileUtils.deleteQuietly(buildDir); // try this method that does not throw an exception
}
if (logFile != null && logFile.exists()) {
//assertTrue(logFile.delete());
assertTrue(logFile.delete());
}
if (errFile != null && errFile.exists()) {
//assertTrue(errFile.delete());
assertTrue(errFile.delete());
}
}

Expand Down
9 changes: 7 additions & 2 deletions src/test/groovy/io/openliberty/tools/gradle/DevTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,15 @@ class DevTest extends BaseDevTest {
tagLog("##testDirectoryTest start");
// create the test directory
File testDir = new File(buildDir, "src/test/java");
assertTrue(testDir.mkdirs());
File unitTestSrcFile = new File(testDir, "UnitTest.java");

if (!testDir.exists()) {
assertTrue("Failed creating directory: "+testDir.getCanonicalPath(), testDir.mkdirs());
} else {
assertTrue("Failed deleting file: "+unitTestSrcFile.getCanonicalPath(), unitTestSrcFile.delete());
}

// creates a java test file
File unitTestSrcFile = new File(testDir, "UnitTest.java");
String unitTest = """import org.junit.Test;\n
import static org.junit.Assert.*;\n
\n
Expand Down

0 comments on commit 260839d

Please sign in to comment.