diff --git a/smithy-model/src/test/java/software/amazon/smithy/model/loader/ModelAssemblerTest.java b/smithy-model/src/test/java/software/amazon/smithy/model/loader/ModelAssemblerTest.java index b8f2b8e8253..76bdca96c07 100644 --- a/smithy-model/src/test/java/software/amazon/smithy/model/loader/ModelAssemblerTest.java +++ b/smithy-model/src/test/java/software/amazon/smithy/model/loader/ModelAssemblerTest.java @@ -30,16 +30,20 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; +import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Collections; +import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; +import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import software.amazon.smithy.model.Model; import software.amazon.smithy.model.SourceLocation; @@ -62,6 +66,18 @@ public class ModelAssemblerTest { + private Path outputDirectory; + + @BeforeEach + public void before() throws IOException { + outputDirectory = Files.createTempDirectory(getClass().getName()); + } + + @AfterEach + public void after() throws IOException { + Files.walk(outputDirectory).sorted(Comparator.reverseOrder()).map(Path::toFile).forEach(File::delete); + } + @Test public void addsExplicitSuppressions() { Suppression suppression = Suppression.builder().addValidatorId("foo").build(); @@ -238,7 +254,7 @@ public void importsSymlinkFileWithAllShapes() throws Exception { } public Path createSymbolicLink(Path target, String linkName) throws IOException { - Path link = Paths.get("./src/test/resources", linkName); + Path link = outputDirectory.resolve(linkName); if (Files.exists(link)) { Files.delete(link); }