Skip to content

Commit

Permalink
Added comments for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
Evan Chicoine committed Nov 21, 2024
1 parent 9352c74 commit 1e80e64
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Objects;

import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
Expand Down Expand Up @@ -216,6 +217,13 @@ public void run() {
assertEquals(17, files.length);
}

/**
* In response to issue https://github.com/cqframework/cqf-tooling/issues/537
* The ExtractMATBundle process defaults to the location of the bundle file
* when no IG folder structure exists (no bundle folder found.)
*
* @throws IOException
*/
@Test
public void TestExtractMatBundleWithNonIGStructuredDirectory() throws IOException {
ClassLoader classLoader = getClass().getClassLoader();
Expand All @@ -225,7 +233,7 @@ public void TestExtractMatBundleWithNonIGStructuredDirectory() throws IOExceptio
throw new IllegalArgumentException("Resource not found: " + resourcePath);
}

// Create a temporary directory named "noIG"
// Create a temporary directory named "noIG" and does not include the name bundles
File tempDir = Files.createTempDirectory("noIG").toFile();
tempDir.deleteOnExit();

Expand All @@ -235,7 +243,8 @@ public void TestExtractMatBundleWithNonIGStructuredDirectory() throws IOExceptio
throw new IllegalArgumentException("Resource path is not a directory: " + resourcePath);
}

for (File file : sourceDir.listFiles()) {
//Copy our test files to the temp folder so the source location of the bundle is the temp folder
for (File file : Objects.requireNonNull(sourceDir.listFiles())) {
File destFile = new File(tempDir, file.getName());
Files.copy(file.toPath(), destFile.toPath());
}
Expand Down

0 comments on commit 1e80e64

Please sign in to comment.