You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by fr...@apache.org on 2026/08/24 08:54:47 UTC

(druid) branch master updated: test: finish remaining JUnit 5 migration cleanup (#20125)

This is an automated email from the ASF dual-hosted git repository.

FrankChen021 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/druid.git


The following commit(s) were added to refs/heads/master by this push:
     new 287b4612f8a test: finish remaining JUnit 5 migration cleanup (#20125)
287b4612f8a is described below

commit 287b4612f8a1437fad1f6f5f102ba6cf3ced8a72
Author: Frank Chen <fr...@outlook.com>
AuthorDate: Mon Aug 24 16:54:39 2026 +0800

    test: finish remaining JUnit 5 migration cleanup (#20125)
    
    * test: finish remaining JUnit 5 migration cleanup
    
    * test: remove unused JUnit 4 dependency paths
    
    * test: use scoped temporary folder extensions
    
    * test: simplify temporary folder usage
    
    * test: address temporary folder review feedback
    
    * test: simplify temporary folder usage
    
    * test: clarify shared temporary folders
    
    * test: restrict temporary folder extension construction
    
    * test: simplify temporary directory usage
    
    * test: simplify processing temporary folder usage
    
    * test: simplify server temporary directory usage
    
    * test: fix Kafka temporary directory reference
    
    * test(processing): isolate schemaless test segments
    
    * test(processing): close schemaless segments per test
    
    * test(processing): use secure temporary directories
    
    * test(processing): remove remaining JUnit 4 dependencies
    
    * test(processing): simplify aggregation helper overload names
    
    * build: remove obsolete JUnit migration tooling
    
    * test: reuse temporary folder extension in wrapper tests
    
    * build: remove obsolete JUnit benchmark dependency
    
    * test: migrate cost balancer benchmark to JUnit 5
    
    * perf: move cost balancer benchmark to JMH
    
    * fix: address final cleanup CI findings
    
    * fix: restore hdfs test directory permissions
    
    * fix: restore kafka test hamcrest dependency
---
 .github/scripts/create-jacoco-coverage-report.sh   |   3 -
 AGENTS.md                                          |   4 +-
 .../coordinator/CostBalancerStrategyBenchmark.java | 135 +++++++--
 dev/validate-junit5-usage                          |  37 ---
 embedded-tests/pom.xml                             |  10 -
 .../testing/embedded/auth/BasicAuthMSQTest.java    |   3 +-
 .../testing/embedded/catalog/CatalogTestBase.java  |  22 +-
 .../druid/testing/embedded/minio/S3PerfTest.java   |  11 +-
 .../testing/embedded/query/QueryErrorTest.java     |  30 +-
 .../server/KillSupervisorsCustomDutyTest.java      |  19 +-
 .../data/input/aliyun/OssInputSourceTest.java      |  20 +-
 .../storage/aliyun/OssDataSegmentPullerTest.java   |  23 +-
 ...pressedBigDecimalAggregatorGroupByTestBase.java |   2 +-
 .../ddsketch/DDSketchAggregatorTest.java           |   2 +-
 .../aggregator/MomentsSketchAggregatorTest.java    |   2 +-
 .../SpectatorHistogramAggregatorTest.java          |  27 +-
 .../tdigestsketch/TDigestSketchAggregatorTest.java |   2 +-
 .../TimestampGroupByAggregationTest.java           |   2 +-
 .../druid/data/input/avro/AvroOCFReaderTest.java   |  15 +-
 extensions-core/datasketches/pom.xml               |  11 -
 .../BaseSketchBuildSegmentMetadataQueryTest.java   |  18 +-
 .../datasketches/hll/HllSketchAggregatorTest.java  |   2 +-
 .../kll/KllDoublesSketchAggregatorTest.java        |   2 +-
 .../kll/KllFloatsSketchAggregatorTest.java         |   2 +-
 .../quantiles/DoublesSketchAggregatorTest.java     |   2 +-
 .../datasketches/theta/SketchAggregationTest.java  |   2 +-
 .../theta/SketchAggregationWithSimpleDataTest.java |   4 +-
 .../theta/oldapi/OldApiSketchAggregationTest.java  |   2 +-
 .../tuple/ArrayOfDoublesSketchAggregationTest.java |   2 +-
 extensions-core/druid-basic-security/pom.xml       |   6 -
 ...rPollingBasicAuthenticatorCacheManagerTest.java |  16 +-
 ...atorPollingBasicAuthorizerCacheManagerTest.java |  15 +-
 extensions-core/druid-bloom-filter/pom.xml         |   5 -
 .../bloom/BloomFilterGroupByQueryTest.java         |   2 +-
 extensions-core/druid-catalog/pom.xml              |   6 -
 extensions-core/druid-testcontainers/pom.xml       |   5 -
 .../google/output/GoogleOutputConfigTest.java      |  16 +-
 .../google/output/GoogleStorageConnectorTest.java  |  15 +-
 .../indexing/common/tasklogs/HdfsTaskLogsTest.java |  22 +-
 .../storage/hdfs/HdfsDataSegmentPusherTest.java    |  74 ++---
 extensions-core/histogram/pom.xml                  |  10 -
 .../ApproximateHistogramAggregationTest.java       |   2 +-
 .../FixedBucketsHistogramAggregationTest.java      |   2 +-
 extensions-core/kafka-indexing-service/pom.xml     |  10 +-
 .../druid/indexing/kafka/KafkaIndexTaskTest.java   |  17 +-
 extensions-core/kinesis-indexing-service/pom.xml   |   5 -
 .../indexing/kinesis/KinesisIndexTaskTest.java     |   2 +-
 extensions-core/lookups-cached-single/pom.xml      |   6 -
 .../apache/druid/data/input/orc/OrcReaderTest.java |  19 +-
 .../parquet/ParquetReaderResourceLeakTest.java     |  13 +-
 .../data/input/parquet/ParquetToJsonTest.java      |  22 +-
 extensions-core/stats/pom.xml                      |   6 -
 extensions-core/testing-tools/pom.xml              |   5 -
 indexing-service/pom.xml                           |  20 --
 .../guice/IndexingServiceTaskLogsModuleTest.java   |  18 +-
 .../druid/guice/PeonProcessingModuleTest.java      |  20 +-
 .../MultipleFileTaskReportFileWriterTest.java      |   9 +-
 .../common/SingleFileTaskReportFileWriterTest.java |   9 +-
 .../druid/indexing/common/TaskToolboxTest.java     |  10 +-
 .../indexing/common/task/AbstractTaskTest.java     |  14 +-
 .../common/task/CompactionTaskParallelRunTest.java |   2 +-
 .../common/task/CompactionTaskRunBase.java         |  32 +-
 .../FilteringCloseableInputRowIteratorTest.java    |  79 ++---
 .../druid/indexing/common/task/IndexTaskTest.java  |   6 +-
 .../indexing/common/task/IngestionTestBase.java    |  24 +-
 .../AbstractParallelIndexSupervisorTaskTest.java   |  22 +-
 .../parallel/DeepStorageShuffleClientTest.java     |  12 +-
 .../parallel/DimensionCardinalityReportTest.java   |  14 +-
 ...ashPartitionAdjustingCorePartitionSizeTest.java |   4 +-
 ...ashPartitionMultiPhaseParallelIndexingTest.java |   8 +-
 .../batch/parallel/HashPartitionTaskKillTest.java  |   2 +-
 .../task/batch/parallel/HttpShuffleClientTest.java |  20 +-
 .../MultiPhaseParallelIndexingRowStatsTest.java    |   2 +-
 .../parallel/ParallelIndexPhaseRunnerTest.java     |   2 +-
 .../task/batch/parallel/PartialCompactionTest.java |   2 +-
 .../PartialDimensionCardinalityTaskTest.java       |  24 +-
 .../PartialDimensionDistributionTaskTest.java      |  24 +-
 ...ngePartitionAdjustingCorePartitionSizeTest.java |   4 +-
 ...ngePartitionMultiPhaseParallelIndexingTest.java |   8 +-
 .../batch/parallel/RangePartitionTaskKillTest.java |   2 +-
 .../parallel/SinglePhaseParallelIndexingTest.java  |   2 +-
 .../indexing/common/tasklogs/FileTaskLogsTest.java |  27 +-
 .../indexing/input/DruidSegmentReaderTest.java     |  42 ++-
 .../indexing/overlord/ForkingTaskRunnerTest.java   |  47 ++-
 .../overlord/SingleTaskBackgroundRunnerTest.java   |   9 +-
 .../druid/indexing/overlord/TaskLifecycleTest.java |  22 +-
 .../RecordSupplierInputSourceTest.java             |  13 +-
 .../SeekableStreamIndexTaskRunnerTest.java         |  10 +-
 .../SeekableStreamIndexTaskTestBase.java           |  10 +-
 .../seekablestream/StreamChunkReaderTest.java      |  18 +-
 ...ocalIntermediaryDataManagerAutoCleanupTest.java |  20 +-
 ...ocalIntermediaryDataManagerConcurrencyTest.java |  20 +-
 ...ermediaryDataManagerManualAddAndDeleteTest.java |  20 +-
 .../shuffle/ShuffleDataSegmentPusherTest.java      |  24 +-
 .../worker/shuffle/ShuffleResourceTest.java        |  19 +-
 .../metadata/MetadataStorageActionHandlerTest.java |   4 +-
 .../SQLMetadataStorageActionHandlerTest.java       | 146 ++++-----
 .../msq/dart/worker/DartWorkerRunnerTest.java      |   2 +-
 .../msq/indexing/report/MSQTaskReportTest.java     |   2 +-
 .../msq/input/RegularLoadableSegmentTest.java      |   2 +-
 .../BroadcastJoinSegmentMapFnProcessorTest.java    |   2 +-
 .../common/SortMergeJoinFrameProcessorTest.java    |   2 +-
 .../output/ChannelStageOutputReaderTest.java       |   4 +-
 .../shuffle/output/NilStageOutputReaderTest.java   |   2 +-
 pom.xml                                            |  29 --
 processing/pom.xml                                 |  36 +--
 .../apache/druid/common/guava/FutureUtilsTest.java |  55 ++--
 .../data/input/BytesCountingInputEntityTest.java   |  21 +-
 .../input/impl/CloudObjectInputSourceTest.java     |  10 +-
 .../druid/data/input/impl/CsvInputFormatTest.java  |  35 +--
 .../druid/data/input/impl/FileEntityTest.java      |  15 +-
 .../input/impl/InputEntityIteratingReaderTest.java |  19 +-
 .../data/input/impl/LocalInputSourceTest.java      |  13 +-
 .../data/input/impl/RetryingInputStreamTest.java   |   9 +-
 .../org/apache/druid/data/input/impl/RowsTest.java |  23 +-
 .../org/apache/druid/error/ExceptionMatcher.java   |  79 ++---
 .../ImmutableConciseSetIntersectionTest.java       |  22 +-
 .../intset/ImmutableConciseSetTest.java            | 176 +++++------
 .../ReadableByteChunksFrameChannelTest.java        |   4 +-
 .../ReadableInputStreamFrameChannelTest.java       |  17 +-
 .../file/FrameFileHttpResponseHandlerTest.java     |   2 +-
 .../org/apache/druid/frame/file/FrameFileTest.java |   2 +-
 .../frame/file/FrameFileWireTransferableTest.java  |  10 +-
 .../druid/frame/file/FrameFileWriterTest.java      |  10 +-
 .../ComposingOutputChannelFactoryTest.java         |  19 +-
 .../processor/FileOutputChannelFactoryTest.java    |  11 +-
 .../processor/FrameProcessorExecutorTest.java      |  31 +-
 .../processor/ReadableFileFrameChannelTest.java    |  11 +-
 .../druid/frame/processor/SuperSorterTest.java     |   6 +-
 .../druid/granularity/QueryGranularityTest.java    | 146 ++++-----
 .../apache/druid/guice/ExtensionsLoaderTest.java   |   2 +-
 .../druid/indexer/report/TaskReportSerdeTest.java  |   2 +-
 .../apache/druid/io/LimitedOutputStreamTest.java   |   9 +-
 .../java/util/common/ByteBufferUtilsTest.java      |  10 +-
 .../java/util/common/CompressionUtilsTest.java     |   2 +-
 .../druid/java/util/common/FileUtilsTest.java      |  71 ++---
 .../druid/java/util/common/io/NativeIOTest.java    |  17 +-
 .../common/io/smoosh/SmooshedFileMapperTest.java   |  38 +--
 .../core/HttpPostEmitterLoggerStressTest.java      |  20 +-
 .../java/util/emitter/core/LoggingEmitterTest.java |   9 +-
 .../java/util/metrics/CgroupCpuMonitorTest.java    |  16 +-
 .../java/util/metrics/CgroupCpuSetMonitorTest.java |  16 +-
 .../java/util/metrics/CgroupDiskMonitorTest.java   |  12 +-
 .../java/util/metrics/CgroupMemoryMonitorTest.java |  12 +-
 .../java/util/metrics/CgroupV2CpuMonitorTest.java  |  13 +-
 .../java/util/metrics/CgroupV2DiskMonitorTest.java |  13 +-
 .../util/metrics/CgroupV2MemoryMonitorTest.java    |  13 +-
 .../java/util/metrics/CpuAcctDeltaMonitorTest.java |  11 +-
 .../druid/java/util/metrics/ProcFsReaderTest.java  |  10 +-
 .../java/util/metrics/cgroups/CpuAcctTest.java     |   2 +-
 .../java/util/metrics/cgroups/CpuSetTest.java      |  12 +-
 .../java/util/metrics/cgroups/CpuSetV2Test.java    |  13 +-
 .../druid/java/util/metrics/cgroups/CpuTest.java   |  12 +-
 .../druid/java/util/metrics/cgroups/CpuV2Test.java |   2 +-
 .../druid/java/util/metrics/cgroups/DiskTest.java  |  12 +-
 .../java/util/metrics/cgroups/MemoryTest.java      |  12 +-
 .../metrics/cgroups/ProcCgroupDiscovererTest.java  |  16 +-
 .../apache/druid/query/CursorGranularizerTest.java |  10 +-
 .../druid/query/MultiValuedDimensionTest.java      |   5 +-
 .../apache/druid/query/NestedDataTestUtils.java    | 305 +++----------------
 .../apache/druid/query/SchemaEvolutionTest.java    |   2 +-
 .../query/aggregation/AggregationTestHelper.java   |  54 +---
 .../ExpressionLambdaAggregationTest.java           |   4 +-
 .../aggregation/StringColumnAggregationTest.java   |   6 +-
 .../hyperloglog/HyperUniquesAggregationTest.java   |   6 +-
 .../mean/DoubleMeanAggregationTest.java            |   6 +-
 .../FinalizingFieldAccessPostAggregatorTest.java   |   4 +-
 .../groupby/ComplexDimensionGroupByQueryTest.java  |   4 +-
 .../query/groupby/NestedDataGroupByQueryTest.java  |   4 +-
 .../query/groupby/NestedGroupByArrayQueryTest.java |   4 +-
 .../groupby/UnnestGroupByQueryRunnerTest.java      |   2 +-
 .../epinephelinae/ConcurrentGrouperTest.java       |   2 +-
 .../epinephelinae/SpillOutputStreamTest.java       |  10 +-
 .../groupby/epinephelinae/SpillingGrouperTest.java |   2 +-
 .../druid/query/lookup/LookupConfigTest.java       |  11 +-
 .../druid/query/metadata/SegmentAnalyzerTest.java  |   2 +-
 .../druid/query/scan/NestedDataScanQueryTest.java  |   4 +-
 .../timeseries/NestedDataTimeseriesQueryTest.java  |   4 +-
 .../druid/query/topn/NestedDataTopNQueryTest.java  |   4 +-
 .../org/apache/druid/segment/CloserExtension.java  |   4 +-
 .../java/org/apache/druid/segment/CloserRule.java  |  85 ------
 .../org/apache/druid/segment/CloserRuleTest.java   |  43 ++-
 .../segment/CustomSegmentizerFactoryTest.java      |  13 +-
 .../IndexIONullColumnsCompatibilityTest.java       |   9 +-
 .../druid/segment/IndexMergerNullHandlingTest.java |  13 +-
 .../druid/segment/IndexMergerRollupTest.java       |  11 +-
 .../apache/druid/segment/IndexMergerTestBase.java  |   2 +-
 .../segment/IndexMergerV10MinMaxTimeTest.java      |   9 +-
 ...eIndexCursorFactoryClusteredProjectionTest.java |  11 +-
 ...alQueryableIndexCursorFactoryClusteredTest.java |  11 +-
 .../PartialQueryableIndexCursorFactoryTest.java    |  27 +-
 ...PartialQueryableIndexCursorFactoryTestBase.java |  11 +-
 .../segment/PartialQueryableIndexSegmentTest.java  |  19 +-
 .../druid/segment/PartialQueryableIndexTest.java   |  21 +-
 .../QueryableIndexColumnCapabilitiesTest.java      |  15 +-
 .../QueryableIndexCursorFactoryClusteredTest.java  |  12 +-
 .../QueryableIndexIndexableAdapterTest.java        |   2 +-
 .../apache/druid/segment/SchemalessIndexTest.java  |  96 +++---
 .../druid/segment/SchemalessTestSimpleTest.java    | 326 +++++++++++----------
 .../org/apache/druid/segment/SegmentUtilsTest.java |  18 +-
 .../druid/segment/UnnestCursorFactoryTest.java     |  15 +-
 .../segment/data/BenchmarkIndexibleWrites.java     |   2 -
 .../data/CompressedColumnarIntsSerializerTest.java |  21 +-
 .../segment/data/CompressedDoublesSerdeTest.java   |   2 +-
 .../segment/data/CompressedFloatsSerdeTest.java    |   2 +-
 .../segment/data/CompressedLongsSerdeTest.java     |   2 +-
 .../CompressedVSizeColumnarIntsSerializerTest.java |  12 +-
 .../data/CompressedVariableSizeBlobColumnTest.java |  31 +-
 .../segment/data/GenericIndexedWriterTest.java     |  14 +-
 ...ressedVSizeColumnarMultiIntsSerializerTest.java |   2 +-
 .../file/PartialSegmentFileMapperV10Test.java      |  40 ++-
 .../segment/file/SegmentFileBuilderV10Test.java    |  40 ++-
 .../segment/file/SegmentFileMapperV10Test.java     |  25 +-
 .../file/SegmentFileMetadataColumnFilesTest.java   |   9 +-
 .../druid/segment/filter/BaseFilterTest.java       |  10 +-
 .../druid/segment/filter/FilterBundleTest.java     |   2 +-
 .../join/BaseHashJoinSegmentCursorFactoryTest.java |   2 +-
 .../druid/segment/join/HashJoinSegmentTest.java    |   2 +-
 .../segment/join/JoinableFactoryWrapperTest.java   |   2 +-
 .../table/BroadcastSegmentIndexedTableTest.java    |   9 +-
 ...ableMMappedQueryableSegmentizerFactoryTest.java |  11 +-
 .../segment/nested/DictionaryIdLookupTest.java     |  13 +-
 ...NestedDataColumnSupplierEmptyFieldsBugTest.java |  13 +-
 .../nested/NestedDataColumnSupplierTest.java       |   2 +-
 .../nested/NestedDataColumnSupplierV4Test.java     |  13 +-
 .../nested/NestedFieldColumnSelectorsTest.java     |  15 +-
 .../nested/ScalarDoubleColumnSupplierTest.java     |  14 +-
 .../nested/ScalarLongColumnSupplierTest.java       |  14 +-
 .../nested/ScalarStringColumnSupplierTest.java     |  14 +-
 .../segment/nested/VariantColumnSupplierTest.java  |   2 +-
 ...ColumnSupportedComplexColumnSerializerTest.java |  11 +-
 ...ryableIndexVectorColumnSelectorFactoryTest.java |  10 +-
 .../virtual/DummyStringVirtualColumnTest.java      |   9 +-
 .../segment/virtual/ExpressionSelectorsTest.java   |   2 +-
 .../virtual/VectorizedVirtualColumnTest.java       |  10 +-
 .../writeout/SegmentWriteOutMediumTest.java        |   2 +-
 .../local/LocalFileStorageConnectorTest.java       |  11 +-
 .../remote/ChunkingStorageConnectorTest.java       |  11 +-
 .../testing/DeadlockDetectingFailOnTimeout.java    | 303 -------------------
 .../druid/testing/DeadlockDetectingTimeout.java    |  47 ---
 .../druid/testing/TemporaryFolderExtension.java    |  54 +++-
 .../druid/testing/junit/LoggerCaptureRule.java     | 140 ---------
 .../org/apache/druid/utils/CloseableUtilsTest.java | 100 ++-----
 rewrite.yml                                        | 139 ---------
 server/pom.xml                                     |  25 +-
 .../apache/druid/client/DirectDruidClientTest.java |   2 +-
 .../apache/druid/client/DruidServerConfigTest.java |   2 +-
 .../apache/druid/metadata/TestDerbyConnector.java  |   5 +-
 .../query/lookup/LookupReferencesManagerTest.java  |   2 +-
 .../query/lookup/LookupSnapshotTakerTest.java      |   2 +-
 .../loading/LocalDataSegmentKillerTest.java        |   2 +-
 .../loading/LocalDataSegmentPullerTest.java        |   2 +-
 .../loading/LocalDataSegmentPusherTest.java        |   2 +-
 .../LocalFileTimestampVersionFinderTest.java       |   2 +-
 .../PartialSegmentBundleCacheEntryTest.java        |  60 ++--
 .../loading/PartialSegmentCacheBootstrapTest.java  |  23 +-
 .../PartialSegmentMetadataCacheEntryTest.java      |  30 +-
 ...SegmentLocalCacheManagerPartialAcquireTest.java |  30 +-
 .../SegmentLocalCacheManagerPartialDropTest.java   |  18 +-
 ...egmentLocalCacheManagerPartialRuleLoadTest.java |  35 +--
 .../loading/SegmentLocalCacheManagerTest.java      |   2 +-
 .../StorageLocationSelectorStrategyTest.java       |   2 +-
 .../StorageLocationVirtualStorageManagerTest.java  |  10 +-
 .../metadata/SegmentMetadataCacheTestBase.java     |   2 +-
 .../appenderator/StreamAppenderatorDriverTest.java |   2 +-
 .../appenderator/StreamAppenderatorTest.java       |   2 +-
 .../apache/druid/server/SegmentManagerTest.java    |   2 +-
 .../SegmentCacheBootstrapperCacheTest.java         |   2 +-
 .../coordination/SegmentCacheBootstrapperTest.java |   2 +-
 .../coordination/SegmentLoadDropHandlerTest.java   |   2 +-
 ...egmentManagerBroadcastJoinIndexedTableTest.java |   2 +-
 .../SegmentManagerThreadSafetyTest.java            |   2 +-
 .../coordinator/CostBalancerStrategyBenchmark.java | 135 ---------
 .../server/initialization/JettyCertRenewTest.java  |   2 +-
 .../druid/server/initialization/JettyTest.java     |   2 +-
 .../druid/server/log/FileRequestLoggerTest.java    |   2 +-
 services/pom.xml                                   |   6 -
 .../java/org/apache/druid/cli/CliPeonTest.java     |   2 +-
 .../java/org/apache/druid/cli/DumpSegmentTest.java |   2 +-
 .../org/apache/druid/cli/PullDependenciesTest.java |   2 +-
 .../org/apache/druid/cli/ValidateSegmentsTest.java |   2 +-
 .../druid/cli/validate/DruidJsonValidatorTest.java |   2 +-
 sql/pom.xml                                        |   6 -
 283 files changed, 2070 insertions(+), 3551 deletions(-)

diff --git a/.github/scripts/create-jacoco-coverage-report.sh b/.github/scripts/create-jacoco-coverage-report.sh
index fc07ae02ddd..8acbcb67e2b 100755
--- a/.github/scripts/create-jacoco-coverage-report.sh
+++ b/.github/scripts/create-jacoco-coverage-report.sh
@@ -67,6 +67,3 @@ fi
 
 echo " * test balancing details"
 .github/scripts/test_balancing_calc
-
-echo " * validate junit4/junit5 usage"
-dev/validate-junit5-usage
diff --git a/AGENTS.md b/AGENTS.md
index 54a1ba0ef89..03dee0c9049 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -51,10 +51,10 @@ When adding or migrating tests, reuse these existing test-scope helpers:
 
   ```java
   @RegisterExtension
-  public final TemporaryFolderExtension temporaryFolder = new TemporaryFolderExtension();
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
   ```
 
-  Use `getRoot()`, `newFolder(...)`, or `newFile(...)`. Prefer `TemporaryFolderExtension` over JUnit 5 `@TempDir` or JUnit 4 `TemporaryFolder`. Do not add new `TempFolderOperations` usages; the existing compatibility bridge is only for tests that have not yet migrated.
+  Use `getRoot()`, `newFolder(...)`, or `newFile(...)`. Prefer `TemporaryFolderExtension` when Druid-specific temporary-directory behavior or helper methods are needed; use JUnit 5 `@TempDir` when a plain temporary root is sufficient.
 
 - `LoggerCaptureExtension` (`org.apache.druid.testing.junit`) for capturing Log4j events. Register it with the target class and use `getLogEvents()`, `clearLogEvents()`, or `awaitLogEvents()` as needed.
 
diff --git a/benchmarks/src/test/java/org/apache/druid/server/coordinator/CostBalancerStrategyBenchmark.java b/benchmarks/src/test/java/org/apache/druid/server/coordinator/CostBalancerStrategyBenchmark.java
index e1a05aea079..bb1d9869f94 100644
--- a/benchmarks/src/test/java/org/apache/druid/server/coordinator/CostBalancerStrategyBenchmark.java
+++ b/benchmarks/src/test/java/org/apache/druid/server/coordinator/CostBalancerStrategyBenchmark.java
@@ -19,54 +19,138 @@
 
 package org.apache.druid.server.coordinator;
 
+import com.google.common.util.concurrent.ListeningExecutorService;
+import com.google.common.util.concurrent.MoreExecutors;
+import org.apache.druid.client.DruidServer;
 import org.apache.druid.java.util.common.DateTimes;
+import org.apache.druid.java.util.common.Intervals;
+import org.apache.druid.java.util.common.concurrent.Execs;
+import org.apache.druid.java.util.common.granularity.Granularities;
+import org.apache.druid.server.coordination.ServerType;
 import org.apache.druid.server.coordinator.balancer.CostBalancerStrategy;
+import org.apache.druid.server.coordinator.loading.TestLoadQueuePeon;
 import org.apache.druid.timeline.DataSegment;
+import org.apache.druid.timeline.SegmentId;
 import org.joda.time.DateTime;
 import org.joda.time.Interval;
 import org.openjdk.jmh.annotations.Benchmark;
 import org.openjdk.jmh.annotations.BenchmarkMode;
 import org.openjdk.jmh.annotations.Fork;
+import org.openjdk.jmh.annotations.Level;
+import org.openjdk.jmh.annotations.Measurement;
 import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OperationsPerInvocation;
 import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Param;
 import org.openjdk.jmh.annotations.Scope;
 import org.openjdk.jmh.annotations.Setup;
 import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.annotations.TearDown;
+import org.openjdk.jmh.annotations.Warmup;
 
 import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Random;
 import java.util.concurrent.ThreadLocalRandom;
 import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
 
 @State(Scope.Benchmark)
+@BenchmarkMode(Mode.AverageTime)
+@OutputTimeUnit(TimeUnit.MICROSECONDS)
+@Warmup(iterations = 10)
+@Measurement(iterations = 10)
+@Fork(1)
 public class CostBalancerStrategyBenchmark
 {
   private static final DateTime T0 = DateTimes.of("2016-01-01T01:00:00Z");
+  private static final Interval INTERVAL1 = Intervals.of("2015-01-01T01:00:00Z/2015-01-01T02:00:00Z");
+  private static final Interval INTERVAL2 = Intervals.of("2015-02-01T01:00:00Z/2015-02-01T02:00:00Z");
+  private static final int NUMBER_OF_SEGMENTS = 10000;
+  private static final int NUMBER_OF_SERVERS = 6;
+  private static final int X1 = 2;
+  private static final int Y0 = 3;
+  private static final int Y1 = 4;
 
   private List<DataSegment> segments;
   private DataSegment segment;
 
-  int x1 = 2;
-  int y0 = 3;
-  int y1 = 4;
-
-  int n = 10000;
-
-  @Setup
-  public void setupDummyCluster()
+  @Setup(Level.Trial)
+  public void setup()
   {
     segment = createSegment(T0);
 
     Random r = ThreadLocalRandom.current();
-    segments = new ArrayList<>(n);
-    for (int i = 0; i < n; ++i) {
+    segments = new ArrayList<>(NUMBER_OF_SEGMENTS);
+    for (int i = 0; i < NUMBER_OF_SEGMENTS; ++i) {
       final DateTime t = T0.minusHours(r.nextInt(365 * 24) - 365 * 12);
       segments.add(createSegment(t));
     }
   }
 
-  DataSegment createSegment(DateTime t)
+  @State(Scope.Benchmark)
+  public static class PlacementState
+  {
+    @Param({"1", "4"})
+    private int numThreads;
+
+    private ListeningExecutorService exec;
+    private CostBalancerStrategy strategy;
+    private List<ServerHolder> serverHolderList;
+    private DataSegment segmentToLoad;
+
+    @Setup(Level.Trial)
+    public void setup()
+    {
+      exec = MoreExecutors.listeningDecorator(Execs.multiThreaded(numThreads, "CostBalancerStrategyBenchmark-%d"));
+      strategy = new CostBalancerStrategy(exec);
+      serverHolderList = initServers();
+      segmentToLoad = DataSegment.builder(SegmentId.of("testds", INTERVAL1, "1000", 0))
+                                 .size(100L)
+                                 .build();
+    }
+
+    @TearDown(Level.Trial)
+    public void tearDown()
+    {
+      exec.shutdownNow();
+    }
+
+    private List<ServerHolder> initServers()
+    {
+      final List<DruidServer> servers = new ArrayList<>();
+      for (int i = 0; i < NUMBER_OF_SERVERS; ++i) {
+        servers.add(
+            new DruidServer(
+                "server_" + i,
+                "localhost",
+                null,
+                10_000_000L,
+                null,
+                ServerType.HISTORICAL,
+                "hot",
+                1
+            )
+        );
+      }
+
+      final List<DataSegment> serverSegments =
+          CreateDataSegments.ofDatasource("wikipedia")
+                            .forIntervals(200, Granularities.DAY)
+                            .withNumPartitions(100)
+                            .eachOfSizeInMb(200);
+      final Random random = new Random(100);
+      serverSegments.forEach(segment -> servers.get(random.nextInt(servers.size())).addDataSegment(segment));
+
+      return servers.stream()
+                    .map(DruidServer::toImmutableDruidServer)
+                    .map(server -> new ServerHolder(server, new TestLoadQueuePeon()))
+                    .collect(Collectors.toList());
+    }
+  }
+
+  private static DataSegment createSegment(DateTime t)
   {
     return new DataSegment(
         "test",
@@ -82,9 +166,6 @@ public class CostBalancerStrategyBenchmark
   }
 
   @Benchmark
-  @BenchmarkMode(Mode.AverageTime)
-  @OutputTimeUnit(TimeUnit.MICROSECONDS)
-  @Fork(1)
   public double measureCostStrategySingle()
   {
     double totalCost = 0;
@@ -95,11 +176,29 @@ public class CostBalancerStrategyBenchmark
   }
 
   @Benchmark
-  @BenchmarkMode(Mode.AverageTime)
-  @OutputTimeUnit(TimeUnit.MICROSECONDS)
-  @Fork(1)
   public double measureIntervalPenalty()
   {
-    return CostBalancerStrategy.intervalCost(x1, y0, y1);
+    return CostBalancerStrategy.intervalCost(X1, Y0, Y1);
+  }
+
+  @Benchmark
+  public ServerHolder measureFindServersToLoadSegment(PlacementState state)
+  {
+    final Iterator<ServerHolder> candidates = state.strategy.findServersToLoadSegment(
+        state.segmentToLoad,
+        state.serverHolderList
+    );
+    return candidates.hasNext() ? candidates.next() : null;
+  }
+
+  @Benchmark
+  @OperationsPerInvocation(1000)
+  public long measureJodaGap()
+  {
+    long diff = 0;
+    for (int i = 0; i < 1000; i++) {
+      diff += INTERVAL1.gap(INTERVAL2).toDurationMillis();
+    }
+    return diff;
   }
 }
diff --git a/dev/validate-junit5-usage b/dev/validate-junit5-usage
deleted file mode 100755
index 1e6f658ace0..00000000000
--- a/dev/validate-junit5-usage
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/bash
-
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#--------------------------------------------------------------------
-
-set -e
-
-git grep junit-jupiter-engine '**/pom.xml' | cut -d: -f1 | while read pom ;do
-
-	m=`dirname $pom`
-	hasj4=`git grep org.junit.Test $m | head -n 1 | wc -l`
-	hasVintage=`git grep junit-vintage-engine $m|head -n 1 | wc -l`
-
-	echo "$m hasj4:$hasj4 hasVintage:$hasVintage"
-
-	if [ "$hasVintage" != "$hasj4" ];then
-		echo "Module [$m] is configured to use junit5 but its configured is not valid!"
-		echo " has_junit4_tests[$hasj4] <> has_vintage_engine[$hasVintage] !"
-		echo
-		echo "The junit4/5 migration guide might be helpfull https://www.baeldung.com/junit-5-migration"
-		echo "Possibly usefull openrewrite docs: https://docs.openrewrite.org/recipes/java/testing/junit5/junit4to5migration"
-		exit 1
-	fi
-done
diff --git a/embedded-tests/pom.xml b/embedded-tests/pom.xml
index f1e0b33b5a1..1ecbf09c0ae 100644
--- a/embedded-tests/pom.xml
+++ b/embedded-tests/pom.xml
@@ -473,11 +473,6 @@
       <artifactId>junit-jupiter</artifactId>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>org.junit.vintage</groupId>
-      <artifactId>junit-vintage-engine</artifactId>
-      <scope>test</scope>
-    </dependency>
     <dependency>
       <groupId>org.junit.jupiter</groupId>
       <artifactId>junit-jupiter-api</artifactId>
@@ -488,11 +483,6 @@
       <artifactId>junit-jupiter-params</artifactId>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
     <dependency>
       <groupId>org.junit.platform</groupId>
       <artifactId>junit-platform-launcher</artifactId>
diff --git a/embedded-tests/src/test/java/org/apache/druid/testing/embedded/auth/BasicAuthMSQTest.java b/embedded-tests/src/test/java/org/apache/druid/testing/embedded/auth/BasicAuthMSQTest.java
index 46210caec44..0b1e48a779d 100644
--- a/embedded-tests/src/test/java/org/apache/druid/testing/embedded/auth/BasicAuthMSQTest.java
+++ b/embedded-tests/src/test/java/org/apache/druid/testing/embedded/auth/BasicAuthMSQTest.java
@@ -42,7 +42,6 @@ import org.apache.druid.testing.embedded.indexing.MoreResources;
 import org.apache.druid.testing.embedded.indexing.Resources;
 import org.apache.druid.testing.embedded.junit5.EmbeddedClusterTestBase;
 import org.apache.druid.testing.embedded.msq.MSQExportDirectory;
-import org.hamcrest.MatcherAssert;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeAll;
@@ -270,7 +269,7 @@ public class BasicAuthMSQTest extends EmbeddedClusterTestBase
       Assertions.fail("Expected submit to fail with 403 Forbidden");
     }
     catch (Exception e) {
-      MatcherAssert.assertThat(e, forbiddenExceptionMatcher());
+      forbiddenExceptionMatcher().assertThat(e);
     }
   }
 
diff --git a/embedded-tests/src/test/java/org/apache/druid/testing/embedded/catalog/CatalogTestBase.java b/embedded-tests/src/test/java/org/apache/druid/testing/embedded/catalog/CatalogTestBase.java
index de034eb46e1..38461c59c52 100644
--- a/embedded-tests/src/test/java/org/apache/druid/testing/embedded/catalog/CatalogTestBase.java
+++ b/embedded-tests/src/test/java/org/apache/druid/testing/embedded/catalog/CatalogTestBase.java
@@ -31,7 +31,6 @@ import org.apache.druid.testing.embedded.EmbeddedHistorical;
 import org.apache.druid.testing.embedded.EmbeddedIndexer;
 import org.apache.druid.testing.embedded.EmbeddedOverlord;
 import org.apache.druid.testing.embedded.junit5.EmbeddedClusterTestBase;
-import org.hamcrest.MatcherAssert;
 import org.junit.jupiter.api.Assertions;
 
 import java.util.List;
@@ -70,18 +69,17 @@ public abstract class CatalogTestBase extends EmbeddedClusterTestBase
 
   void verifySubmitSqlTaskFailsWith400BadRequest(String sql, String expectedMessageSubstring)
   {
-    MatcherAssert.assertThat(
-        Assertions.assertThrows(
-            Exception.class,
-            () -> cluster.callApi().onAnyBroker(
-                b -> b.submitSqlTask(
-                    new ClientSqlQuery(sql, null, false, false, false, Map.of(), List.of())
-                )
+    final Throwable exception = Assertions.assertThrows(
+        Exception.class,
+        () -> cluster.callApi().onAnyBroker(
+            b -> b.submitSqlTask(
+                new ClientSqlQuery(sql, null, false, false, false, Map.of(), List.of())
             )
-        ),
-        ExceptionMatcher.of(HttpResponseException.class)
-                        .expectMessageContains("400 Bad Request")
-                        .expectMessageContains(expectedMessageSubstring)
+        )
     );
+    ExceptionMatcher.of(HttpResponseException.class)
+                    .expectMessageContains("400 Bad Request")
+                    .expectMessageContains(expectedMessageSubstring)
+                    .assertThat(exception);
   }
 }
diff --git a/embedded-tests/src/test/java/org/apache/druid/testing/embedded/minio/S3PerfTest.java b/embedded-tests/src/test/java/org/apache/druid/testing/embedded/minio/S3PerfTest.java
index 4753c50ab14..3446998f3f2 100644
--- a/embedded-tests/src/test/java/org/apache/druid/testing/embedded/minio/S3PerfTest.java
+++ b/embedded-tests/src/test/java/org/apache/druid/testing/embedded/minio/S3PerfTest.java
@@ -25,6 +25,7 @@ import org.apache.druid.indexing.common.task.TaskBuilder;
 import org.apache.druid.java.util.common.DateTimes;
 import org.apache.druid.java.util.common.logger.Logger;
 import org.apache.druid.storage.s3.S3StorageDruidModule;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.apache.druid.testing.embedded.EmbeddedBroker;
 import org.apache.druid.testing.embedded.EmbeddedClusterApis;
 import org.apache.druid.testing.embedded.EmbeddedCoordinator;
@@ -41,7 +42,7 @@ import org.junit.jupiter.api.Nested;
 import org.junit.jupiter.api.Tag;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.Timeout;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.BufferedWriter;
 import java.io.File;
@@ -83,6 +84,11 @@ public class S3PerfTest
 
   abstract static class PerfTestBase extends EmbeddedClusterTestBase
   {
+    //CHECKSTYLE.OFF: ConstantName
+    @RegisterExtension
+    static final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.classScoped();
+    //CHECKSTYLE.ON: ConstantName
+
     private final List<File> tempFiles = new ArrayList<>();
 
     final EmbeddedOverlord overlord = new EmbeddedOverlord();
@@ -109,8 +115,9 @@ public class S3PerfTest
     }
 
     @BeforeAll
-    void generateInputFiles(@TempDir Path tempDir) throws IOException
+    void generateInputFiles() throws IOException
     {
+      final Path tempDir = temporaryFolder.getRoot().toPath();
       final DateTime baseDay = DateTimes.of("2025-01-01");
       for (int i = 0; i < TASK_COUNT; i++) {
         final File f = generateLargeCsvFile(tempDir, baseDay.plusDays(i), ROWS_PER_TASK);
diff --git a/embedded-tests/src/test/java/org/apache/druid/testing/embedded/query/QueryErrorTest.java b/embedded-tests/src/test/java/org/apache/druid/testing/embedded/query/QueryErrorTest.java
index 5b7846b0570..6e59e029d83 100644
--- a/embedded-tests/src/test/java/org/apache/druid/testing/embedded/query/QueryErrorTest.java
+++ b/embedded-tests/src/test/java/org/apache/druid/testing/embedded/query/QueryErrorTest.java
@@ -30,7 +30,6 @@ import org.apache.druid.query.http.SqlTaskStatus;
 import org.apache.druid.rpc.HttpResponseException;
 import org.apache.druid.testing.embedded.EmbeddedClusterApis;
 import org.apache.druid.testing.embedded.msq.EmbeddedMSQApis;
-import org.hamcrest.MatcherAssert;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
 
@@ -76,7 +75,7 @@ public class QueryErrorTest extends QueryTestBase
   @Test
   public void testSqlParseException()
   {
-    MatcherAssert.assertThat(
+    assertException(
         Assertions.assertThrows(
             Exception.class,
             () -> cluster.runSql("FROM foo_bar")
@@ -89,7 +88,7 @@ public class QueryErrorTest extends QueryTestBase
   @Test
   public void testSqlValidationException()
   {
-    MatcherAssert.assertThat(
+    assertException(
         Assertions.assertThrows(
             Exception.class,
             () -> cluster.runSql("SELECT * FROM foo_bar")
@@ -102,7 +101,7 @@ public class QueryErrorTest extends QueryTestBase
   @Test
   public void testQueryTimeout()
   {
-    MatcherAssert.assertThat(
+    assertException(
         Assertions.assertThrows(
             Exception.class,
             () -> cluster.callApi().onAnyBroker(
@@ -113,7 +112,7 @@ public class QueryErrorTest extends QueryTestBase
                         .expectMessageContains("504")
     );
 
-    MatcherAssert.assertThat(
+    assertException(
         Assertions.assertThrows(
             Exception.class,
             () -> cluster.callApi().onAnyBroker(
@@ -128,7 +127,7 @@ public class QueryErrorTest extends QueryTestBase
   @Test
   public void testQueryCapacityExceeded()
   {
-    MatcherAssert.assertThat(
+    assertException(
         Assertions.assertThrows(
             Exception.class,
             () -> cluster.callApi().onAnyBroker(
@@ -139,7 +138,7 @@ public class QueryErrorTest extends QueryTestBase
                         .expectMessageContains("429")
     );
 
-    MatcherAssert.assertThat(
+    assertException(
         Assertions.assertThrows(
             Exception.class,
             () -> cluster.callApi().onAnyBroker(
@@ -154,7 +153,7 @@ public class QueryErrorTest extends QueryTestBase
   @Test
   public void testQueryUnsupported()
   {
-    MatcherAssert.assertThat(
+    assertException(
         Assertions.assertThrows(
             Exception.class,
             () -> cluster.callApi().onAnyBroker(
@@ -165,7 +164,7 @@ public class QueryErrorTest extends QueryTestBase
                         .expectMessageContains("501")
     );
 
-    MatcherAssert.assertThat(
+    assertException(
         Assertions.assertThrows(
             Exception.class,
             () -> cluster.callApi().onAnyBroker(
@@ -181,7 +180,7 @@ public class QueryErrorTest extends QueryTestBase
   public void testQueryResourceLimitExceeded()
   {
     // SQL
-    MatcherAssert.assertThat(
+    assertException(
         Assertions.assertThrows(
             Exception.class,
             () -> cluster.callApi().onAnyBroker(
@@ -193,7 +192,7 @@ public class QueryErrorTest extends QueryTestBase
     );
 
     // Native
-    MatcherAssert.assertThat(
+    assertException(
         Assertions.assertThrows(
             Exception.class,
             () -> cluster.callApi().onAnyBroker(
@@ -208,7 +207,7 @@ public class QueryErrorTest extends QueryTestBase
   @Test
   public void testQueryFailure()
   {
-    MatcherAssert.assertThat(
+    assertException(
         Assertions.assertThrows(
             Exception.class,
             () -> cluster.callApi().onAnyBroker(
@@ -219,7 +218,7 @@ public class QueryErrorTest extends QueryTestBase
                         .expectMessageContains("500")
     );
 
-    MatcherAssert.assertThat(
+    assertException(
         Assertions.assertThrows(
             Exception.class,
             () -> cluster.callApi().onAnyBroker(
@@ -240,6 +239,11 @@ public class QueryErrorTest extends QueryTestBase
     return context;
   }
 
+  private static void assertException(final Throwable actual, final ExceptionMatcher expected)
+  {
+    expected.assertThat(actual);
+  }
+
   /**
    * Set up a SQL query future for the test.
    */
diff --git a/embedded-tests/src/test/java/org/apache/druid/testing/embedded/server/KillSupervisorsCustomDutyTest.java b/embedded-tests/src/test/java/org/apache/druid/testing/embedded/server/KillSupervisorsCustomDutyTest.java
index 156f7ece608..7c103765957 100644
--- a/embedded-tests/src/test/java/org/apache/druid/testing/embedded/server/KillSupervisorsCustomDutyTest.java
+++ b/embedded-tests/src/test/java/org/apache/druid/testing/embedded/server/KillSupervisorsCustomDutyTest.java
@@ -34,7 +34,6 @@ import org.apache.druid.testing.embedded.EmbeddedCoordinator;
 import org.apache.druid.testing.embedded.EmbeddedDruidCluster;
 import org.apache.druid.testing.embedded.EmbeddedOverlord;
 import org.apache.druid.testing.embedded.junit5.EmbeddedClusterTestBase;
-import org.hamcrest.MatcherAssert;
 import org.jboss.netty.handler.codec.http.HttpMethod;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
@@ -96,17 +95,15 @@ public class KillSupervisorsCustomDutyTest extends EmbeddedClusterTestBase
     );
 
     // Verify that the history now returns 404 Not Found
-    MatcherAssert.assertThat(
-        Assertions.assertThrows(
-            RuntimeException.class,
-            () -> getSupervisorHistory(supervisor.getId())
-        ),
-        ExceptionMatcher.of(RuntimeException.class).expectRootCause(
-            ExceptionMatcher.of(HttpResponseException.class)
-                            .expectMessageContains("404 Not Found")
-                            .expectMessageContains(StringUtils.format("No history for [%s]", supervisor.getId()))
-        )
+    final Throwable exception = Assertions.assertThrows(
+        RuntimeException.class,
+        () -> getSupervisorHistory(supervisor.getId())
     );
+    ExceptionMatcher.of(RuntimeException.class).expectRootCause(
+        ExceptionMatcher.of(HttpResponseException.class)
+                        .expectMessageContains("404 Not Found")
+                        .expectMessageContains(StringUtils.format("No history for [%s]", supervisor.getId()))
+    ).assertThat(exception);
   }
 
   private List<VersionedSupervisorSpec> getSupervisorHistory(String supervisorId)
diff --git a/extensions-contrib/aliyun-oss-extensions/src/test/java/org/apache/druid/data/input/aliyun/OssInputSourceTest.java b/extensions-contrib/aliyun-oss-extensions/src/test/java/org/apache/druid/data/input/aliyun/OssInputSourceTest.java
index 60c2217ea2a..a91f99729ef 100644
--- a/extensions-contrib/aliyun-oss-extensions/src/test/java/org/apache/druid/data/input/aliyun/OssInputSourceTest.java
+++ b/extensions-contrib/aliyun-oss-extensions/src/test/java/org/apache/druid/data/input/aliyun/OssInputSourceTest.java
@@ -59,7 +59,6 @@ import org.apache.druid.data.input.impl.systemfield.SystemField;
 import org.apache.druid.data.input.impl.systemfield.SystemFields;
 import org.apache.druid.initialization.DruidModule;
 import org.apache.druid.java.util.common.DateTimes;
-import org.apache.druid.java.util.common.FileUtils;
 import org.apache.druid.java.util.common.HumanReadableBytes;
 import org.apache.druid.java.util.common.StringUtils;
 import org.apache.druid.java.util.common.parsers.CloseableIterator;
@@ -69,17 +68,17 @@ import org.apache.druid.storage.aliyun.OssInputDataConfig;
 import org.apache.druid.storage.aliyun.OssStorageDruidModule;
 import org.apache.druid.storage.aliyun.OssUtils;
 import org.apache.druid.testing.InitializedNullHandlingTest;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.apache.druid.utils.CompressionUtils;
 import org.easymock.EasyMock;
 import org.easymock.IArgumentMatcher;
 import org.joda.time.DateTime;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
-import java.io.File;
 import java.io.IOException;
 import java.net.URI;
 import java.util.Arrays;
@@ -141,8 +140,8 @@ public class OssInputSourceTest extends InitializedNullHandlingTest
     INPUT_DATA_CONFIG.setMaxListingLength(MAX_LISTING_LENGTH);
   }
 
-  @TempDir
-  public File temporaryFolder;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   @Test
   public void testSerdeWithUris() throws Exception
@@ -543,7 +542,7 @@ public class OssInputSourceTest extends InitializedNullHandlingTest
     InputSourceReader reader = inputSource.reader(
         someSchema,
         new CsvInputFormat(ImmutableList.of("time", "dim1", "dim2"), "|", false, null, 0, null),
-        newFolder(temporaryFolder, "junit")
+        temporaryFolder.newFolder()
     );
 
     final InputStats inputStats = new InputStatsImpl();
@@ -590,7 +589,7 @@ public class OssInputSourceTest extends InitializedNullHandlingTest
     InputSourceReader reader = inputSource.reader(
         someSchema,
         new CsvInputFormat(ImmutableList.of("time", "dim1", "dim2"), "|", false, null, 0, null),
-        newFolder(temporaryFolder, "junit")
+        temporaryFolder.newFolder()
     );
 
     final InputStats inputStats = new InputStatsImpl();
@@ -809,11 +808,4 @@ public class OssInputSourceTest extends InitializedNullHandlingTest
     return retVal;
   }
 
-  private static File newFolder(File root, String... subDirs) throws IOException
-  {
-    final String subFolder = String.join("/", subDirs);
-    final File result = new File(root, subFolder);
-    FileUtils.mkdirp(result);
-    return result;
-  }
 }
diff --git a/extensions-contrib/aliyun-oss-extensions/src/test/java/org/apache/druid/storage/aliyun/OssDataSegmentPullerTest.java b/extensions-contrib/aliyun-oss-extensions/src/test/java/org/apache/druid/storage/aliyun/OssDataSegmentPullerTest.java
index 485e1236b39..8db0e406423 100644
--- a/extensions-contrib/aliyun-oss-extensions/src/test/java/org/apache/druid/storage/aliyun/OssDataSegmentPullerTest.java
+++ b/extensions-contrib/aliyun-oss-extensions/src/test/java/org/apache/druid/storage/aliyun/OssDataSegmentPullerTest.java
@@ -28,10 +28,11 @@ import org.apache.druid.data.input.impl.CloudObjectLocation;
 import org.apache.druid.java.util.common.FileUtils;
 import org.apache.druid.java.util.common.StringUtils;
 import org.apache.druid.segment.loading.SegmentLoadingException;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.easymock.EasyMock;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.File;
 import java.io.FileInputStream;
@@ -49,8 +50,8 @@ import java.util.zip.GZIPOutputStream;
  */
 public class OssDataSegmentPullerTest
 {
-  @TempDir
-  public File temporaryFolder;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   @Test
   public void testSimpleGetVersion() throws IOException
@@ -93,7 +94,7 @@ public class OssDataSegmentPullerTest
     final OSS ossClient = EasyMock.createStrictMock(OSS.class);
     final byte[] value = bucket.getBytes(StandardCharsets.UTF_8);
 
-    final File tmpFile = new File(temporaryFolder, "gzTest.gz");
+    final File tmpFile = new File(temporaryFolder.getRoot(), "gzTest.gz");
 
     try (final FileOutputStream fileOutputStream = new FileOutputStream(tmpFile);
          final OutputStream outputStream = new GZIPOutputStream(fileOutputStream)) {
@@ -113,7 +114,7 @@ public class OssDataSegmentPullerTest
     final ObjectMetadata objectMetadata = new ObjectMetadata();
     objectMetadata.setLastModified(new Date(1));
 
-    final File tmpDir = newFolder(temporaryFolder, "gzTestDir");
+    final File tmpDir = temporaryFolder.newFolder();
 
     try (final InputStream objectContent = new FileInputStream(tmpFile)) {
       object0.setObjectContent(objectContent);
@@ -152,7 +153,7 @@ public class OssDataSegmentPullerTest
     final OSS ossClient = EasyMock.createStrictMock(OSS.class);
     final byte[] value = bucket.getBytes(StandardCharsets.UTF_8);
 
-    final File tmpFile = new File(temporaryFolder, "gzTest.gz");
+    final File tmpFile = new File(temporaryFolder.getRoot(), "gzTest.gz");
 
     try (final FileOutputStream fileOutputStream = new FileOutputStream(tmpFile);
          final OutputStream outputStream = new GZIPOutputStream(fileOutputStream)) {
@@ -168,7 +169,7 @@ public class OssDataSegmentPullerTest
     final ObjectMetadata objectMetadata = new ObjectMetadata();
     objectMetadata.setLastModified(new Date(0));
 
-    File tmpDir = newFolder(temporaryFolder, "gzTestDir");
+    File tmpDir = temporaryFolder.newFolder();
 
     OSSException exception = new OSSException("OssDataSegmentPullerTest", "NoSuchKey", null, null, null, null, null);
     try (final InputStream objectContent = new FileInputStream(tmpFile)) {
@@ -206,12 +207,4 @@ public class OssDataSegmentPullerTest
     }
   }
 
-  private static File newFolder(File root, String... subDirs) throws IOException
-  {
-    final String subFolder = String.join("/", subDirs);
-    final File result = new File(root, subFolder);
-    FileUtils.mkdirp(result);
-    return result;
-  }
-
 }
diff --git a/extensions-contrib/compressed-bigdecimal/src/test/java/org/apache/druid/compressedbigdecimal/aggregator/CompressedBigDecimalAggregatorGroupByTestBase.java b/extensions-contrib/compressed-bigdecimal/src/test/java/org/apache/druid/compressedbigdecimal/aggregator/CompressedBigDecimalAggregatorGroupByTestBase.java
index 740240b655a..33cf6b01afd 100644
--- a/extensions-contrib/compressed-bigdecimal/src/test/java/org/apache/druid/compressedbigdecimal/aggregator/CompressedBigDecimalAggregatorGroupByTestBase.java
+++ b/extensions-contrib/compressed-bigdecimal/src/test/java/org/apache/druid/compressedbigdecimal/aggregator/CompressedBigDecimalAggregatorGroupByTestBase.java
@@ -66,7 +66,7 @@ public abstract class CompressedBigDecimalAggregatorGroupByTestBase
   {
     final CompressedBigDecimalModule module = new CompressedBigDecimalModule();
     CompressedBigDecimalModule.registerSerde();
-    helper = AggregationTestHelper.createGroupByQueryAggregationTestHelperWithTempDir(
+    helper = AggregationTestHelper.createGroupByQueryAggregationTestHelper(
         module.getJacksonModules(),
         config,
         tempFolder
diff --git a/extensions-contrib/ddsketch/src/test/java/org/apache/druid/query/aggregation/ddsketch/DDSketchAggregatorTest.java b/extensions-contrib/ddsketch/src/test/java/org/apache/druid/query/aggregation/ddsketch/DDSketchAggregatorTest.java
index 4c1a72a5449..2b1f88f1b32 100644
--- a/extensions-contrib/ddsketch/src/test/java/org/apache/druid/query/aggregation/ddsketch/DDSketchAggregatorTest.java
+++ b/extensions-contrib/ddsketch/src/test/java/org/apache/druid/query/aggregation/ddsketch/DDSketchAggregatorTest.java
@@ -71,7 +71,7 @@ public class DDSketchAggregatorTest extends InitializedNullHandlingTest
   {
     DDSketchModule module = new DDSketchModule();
     DDSketchModule.registerSerde();
-    helper = AggregationTestHelper.createGroupByQueryAggregationTestHelperWithTempDir(
+    helper = AggregationTestHelper.createGroupByQueryAggregationTestHelper(
         module.getJacksonModules(), config, tempFolder);
   }
 
diff --git a/extensions-contrib/momentsketch/src/test/java/org/apache/druid/query/aggregation/momentsketch/aggregator/MomentsSketchAggregatorTest.java b/extensions-contrib/momentsketch/src/test/java/org/apache/druid/query/aggregation/momentsketch/aggregator/MomentsSketchAggregatorTest.java
index a7a8aa7d7d6..a72939a3c02 100644
--- a/extensions-contrib/momentsketch/src/test/java/org/apache/druid/query/aggregation/momentsketch/aggregator/MomentsSketchAggregatorTest.java
+++ b/extensions-contrib/momentsketch/src/test/java/org/apache/druid/query/aggregation/momentsketch/aggregator/MomentsSketchAggregatorTest.java
@@ -74,7 +74,7 @@ public class MomentsSketchAggregatorTest extends InitializedNullHandlingTest
   {
     MomentSketchModule.registerSerde();
     DruidModule module = new MomentSketchModule();
-    helper = AggregationTestHelper.createGroupByQueryAggregationTestHelperWithTempDir(
+    helper = AggregationTestHelper.createGroupByQueryAggregationTestHelper(
         module.getJacksonModules(), config, tempFolder);
   }
 
diff --git a/extensions-contrib/spectator-histogram/src/test/java/org/apache/druid/spectator/histogram/SpectatorHistogramAggregatorTest.java b/extensions-contrib/spectator-histogram/src/test/java/org/apache/druid/spectator/histogram/SpectatorHistogramAggregatorTest.java
index bbf76451e51..bd967a348f9 100644
--- a/extensions-contrib/spectator-histogram/src/test/java/org/apache/druid/spectator/histogram/SpectatorHistogramAggregatorTest.java
+++ b/extensions-contrib/spectator-histogram/src/test/java/org/apache/druid/spectator/histogram/SpectatorHistogramAggregatorTest.java
@@ -32,7 +32,6 @@ import org.apache.druid.data.input.impl.DimensionsSpec;
 import org.apache.druid.data.input.impl.TimestampSpec;
 import org.apache.druid.jackson.DefaultObjectMapper;
 import org.apache.druid.java.util.common.DateTimes;
-import org.apache.druid.java.util.common.FileUtils;
 import org.apache.druid.java.util.common.granularity.Granularities;
 import org.apache.druid.java.util.common.guava.Sequence;
 import org.apache.druid.query.Druids;
@@ -74,17 +73,17 @@ import org.apache.druid.segment.column.ColumnConfig;
 import org.apache.druid.segment.incremental.IncrementalIndex;
 import org.apache.druid.segment.incremental.IncrementalIndexSchema;
 import org.apache.druid.testing.InitializedNullHandlingTest;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.apache.druid.timeline.SegmentId;
 import org.joda.time.DateTime;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.params.ParameterizedClass;
 import org.junit.jupiter.params.provider.MethodSource;
 
 import java.io.File;
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -105,8 +104,8 @@ public class SpectatorHistogramAggregatorTest extends InitializedNullHandlingTes
   private static final DelimitedInputFormat INPUT_FORMAT = DelimitedInputFormat.forColumns(
       List.of("timestamp", "product", "cost")
   );
-  @TempDir
-  public File tempFolder;
+  @RegisterExtension
+  public final TemporaryFolderExtension tempFolder = TemporaryFolderExtension.testCaseScoped();
 
   private static final SegmentMetadataQueryRunnerFactory METADATA_QR_FACTORY = new SegmentMetadataQueryRunnerFactory(
       new SegmentMetadataQueryQueryToolChest(new SegmentMetadataQueryConfig()),
@@ -142,11 +141,11 @@ public class SpectatorHistogramAggregatorTest extends InitializedNullHandlingTes
   {
     SpectatorHistogramModule.registerSerde();
     SpectatorHistogramModule module = new SpectatorHistogramModule();
-    helper = AggregationTestHelper.createGroupByQueryAggregationTestHelperWithTempDir(
-        module.getJacksonModules(), config, tempFolder);
+    helper = AggregationTestHelper.createGroupByQueryAggregationTestHelper(
+        module.getJacksonModules(), config, tempFolder.getRoot());
     timeSeriesHelper = AggregationTestHelper.createTimeseriesQueryAggregationTestHelperWithTempDir(
         module.getJacksonModules(),
-        tempFolder
+        tempFolder.getRoot()
     );
   }
 
@@ -467,7 +466,7 @@ public class SpectatorHistogramAggregatorTest extends InitializedNullHandlingTes
   @Test
   public void testMetadataQueryTimer() throws Exception
   {
-    File segmentDir = newFolder(tempFolder, "junit");
+    File segmentDir = tempFolder.newFolder();
     helper.createIndex(
         new File(this.getClass().getClassLoader().getResource("input_data.tsv").getFile()),
         INPUT_ROW_SCHEMA,
@@ -513,7 +512,7 @@ public class SpectatorHistogramAggregatorTest extends InitializedNullHandlingTes
   @Test
   public void testMetadataQueryDistribution() throws Exception
   {
-    File segmentDir = newFolder(tempFolder, "junit");
+    File segmentDir = tempFolder.newFolder();
     helper.createIndex(
         new File(this.getClass().getClassLoader().getResource("input_data.tsv").getFile()),
         INPUT_ROW_SCHEMA,
@@ -841,12 +840,4 @@ public class SpectatorHistogramAggregatorTest extends InitializedNullHandlingTes
     Assertions.assertEquals(EXPECTED_HISTOGRAMS.get(product), histogram, "Count values didn't match");
   }
 
-  private static File newFolder(File root, String... subDirs) throws IOException
-  {
-    final String subFolder = String.join("/", subDirs);
-    final File result = new File(root, subFolder);
-    FileUtils.mkdirp(result);
-    return result;
-  }
-
 }
diff --git a/extensions-contrib/tdigestsketch/src/test/java/org/apache/druid/query/aggregation/tdigestsketch/TDigestSketchAggregatorTest.java b/extensions-contrib/tdigestsketch/src/test/java/org/apache/druid/query/aggregation/tdigestsketch/TDigestSketchAggregatorTest.java
index c00334c6189..64fc1854132 100644
--- a/extensions-contrib/tdigestsketch/src/test/java/org/apache/druid/query/aggregation/tdigestsketch/TDigestSketchAggregatorTest.java
+++ b/extensions-contrib/tdigestsketch/src/test/java/org/apache/druid/query/aggregation/tdigestsketch/TDigestSketchAggregatorTest.java
@@ -72,7 +72,7 @@ public class TDigestSketchAggregatorTest extends InitializedNullHandlingTest
   {
     TDigestSketchModule.registerSerde();
     TDigestSketchModule module = new TDigestSketchModule();
-    helper = AggregationTestHelper.createGroupByQueryAggregationTestHelperWithTempDir(
+    helper = AggregationTestHelper.createGroupByQueryAggregationTestHelper(
         module.getJacksonModules(), config, tempFolder);
     InjectableValues currentInjectableValues = helper.getObjectMapper().getInjectableValues();
     InjectableValues.Std currentInjectableValuesStd = (InjectableValues.Std) currentInjectableValues;
diff --git a/extensions-contrib/time-min-max/src/test/java/org/apache/druid/query/aggregation/TimestampGroupByAggregationTest.java b/extensions-contrib/time-min-max/src/test/java/org/apache/druid/query/aggregation/TimestampGroupByAggregationTest.java
index 45b80c4a9f9..0a1d9c7a5ad 100644
--- a/extensions-contrib/time-min-max/src/test/java/org/apache/druid/query/aggregation/TimestampGroupByAggregationTest.java
+++ b/extensions-contrib/time-min-max/src/test/java/org/apache/druid/query/aggregation/TimestampGroupByAggregationTest.java
@@ -106,7 +106,7 @@ public class TimestampGroupByAggregationTest
 
   private void setup()
   {
-    helper = AggregationTestHelper.createGroupByQueryAggregationTestHelperWithTempDir(
+    helper = AggregationTestHelper.createGroupByQueryAggregationTestHelper(
         new TimestampMinMaxModule().getJacksonModules(),
         config,
         temporaryFolder
diff --git a/extensions-core/avro-extensions/src/test/java/org/apache/druid/data/input/avro/AvroOCFReaderTest.java b/extensions-core/avro-extensions/src/test/java/org/apache/druid/data/input/avro/AvroOCFReaderTest.java
index 8aa061582d6..7d33062d8d2 100644
--- a/extensions-core/avro-extensions/src/test/java/org/apache/druid/data/input/avro/AvroOCFReaderTest.java
+++ b/extensions-core/avro-extensions/src/test/java/org/apache/druid/data/input/avro/AvroOCFReaderTest.java
@@ -36,11 +36,11 @@ import org.apache.druid.data.input.impl.FileEntity;
 import org.apache.druid.data.input.impl.TimestampSpec;
 import org.apache.druid.jackson.DefaultObjectMapper;
 import org.apache.druid.java.util.common.DateTimes;
-import org.apache.druid.java.util.common.FileUtils;
 import org.apache.druid.java.util.common.parsers.CloseableIterator;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.File;
 import java.io.IOException;
@@ -49,8 +49,8 @@ import java.util.Map;
 
 public class AvroOCFReaderTest
 {
-  @TempDir
-  public File temporaryFolder;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   @Test
   public void testParse() throws Exception
@@ -198,11 +198,6 @@ public class AvroOCFReaderTest
     final AvroOCFInputFormat inputFormat = new AvroOCFInputFormat(mapper, null, readerSchema, null, null);
     final InputRowSchema schema = new InputRowSchema(TimestampSpec.DEFAULT, dimensionsSpec, ColumnsFilter.all());
     final FileEntity entity = new FileEntity(someAvroFile);
-    return inputFormat.createReader(schema, entity, newFolder(temporaryFolder, "junit"));
-  }
-
-  private static File newFolder(File root, String... subDirs)
-  {
-    return FileUtils.createTempDirInLocation(root.toPath(), String.join("-", subDirs));
+    return inputFormat.createReader(schema, entity, temporaryFolder.newFolder());
   }
 }
diff --git a/extensions-core/datasketches/pom.xml b/extensions-core/datasketches/pom.xml
index 3fa4783bcf1..4b43d4b6445 100644
--- a/extensions-core/datasketches/pom.xml
+++ b/extensions-core/datasketches/pom.xml
@@ -145,17 +145,6 @@
     </dependency>
 
     <!-- Test Dependencies -->
-    <!--
-      AggregationTestHelper comes from processing's test-jar and currently exposes
-      org.junit.rules.TemporaryFolder in its public test-helper API. Keep the JUnit 4
-      API dependency (but not the Vintage engine) until that shared helper is migrated
-      to a JUnit 5-compatible temp-directory API.
-    -->
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
     <dependency>
       <groupId>org.junit.jupiter</groupId>
       <artifactId>junit-jupiter-api</artifactId>
diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/BaseSketchBuildSegmentMetadataQueryTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/BaseSketchBuildSegmentMetadataQueryTest.java
index 97cb8780673..33710e42091 100644
--- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/BaseSketchBuildSegmentMetadataQueryTest.java
+++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/BaseSketchBuildSegmentMetadataQueryTest.java
@@ -22,7 +22,6 @@ package org.apache.druid.query.aggregation.datasketches;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.druid.data.input.MapBasedInputRow;
 import org.apache.druid.java.util.common.DateTimes;
-import org.apache.druid.java.util.common.FileUtils;
 import org.apache.druid.java.util.common.Intervals;
 import org.apache.druid.java.util.common.granularity.Granularities;
 import org.apache.druid.java.util.common.guava.Sequence;
@@ -57,11 +56,12 @@ import org.apache.druid.segment.incremental.IncrementalIndexSchema;
 import org.apache.druid.segment.incremental.OnheapIncrementalIndex;
 import org.apache.druid.segment.writeout.OffHeapMemorySegmentWriteOutMediumFactory;
 import org.apache.druid.testing.InitializedNullHandlingTest;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.apache.druid.timeline.SegmentId;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.File;
 import java.util.Collections;
@@ -82,8 +82,8 @@ public abstract class BaseSketchBuildSegmentMetadataQueryTest extends Initialize
   protected static final String SKETCH_COLUMN = "sketch";
   protected static final String DIM_COLUMN = "dim";
 
-  @TempDir
-  public File tempFolder;
+  @RegisterExtension
+  public final TemporaryFolderExtension tempFolder = TemporaryFolderExtension.testCaseScoped();
 
   private IndexIO indexIO;
   private IndexMergerV9 indexMerger;
@@ -147,7 +147,7 @@ public abstract class BaseSketchBuildSegmentMetadataQueryTest extends Initialize
     // Create a QueryableIndex (simulates historical/persisted segment)
     IncrementalIndex indexToPersist = closer.register(createIncrementalIndex(aggregators));
     addRows(indexToPersist, 100, 200);
-    File segmentDir = newFolder(tempFolder, "junit");
+    File segmentDir = tempFolder.newFolder();
     indexMerger.persist(indexToPersist, segmentDir, IndexSpec.getDefault(), null);
     QueryableIndex queryableIndex = closer.register(indexIO.loadIndex(segmentDir));
 
@@ -240,13 +240,13 @@ public abstract class BaseSketchBuildSegmentMetadataQueryTest extends Initialize
     // Create two persisted segments
     IncrementalIndex index1 = closer.register(createIncrementalIndex(aggregators));
     addRows(index1, 0, 100);
-    File segmentDir1 = newFolder(tempFolder, "junit");
+    File segmentDir1 = tempFolder.newFolder();
     indexMerger.persist(index1, segmentDir1, IndexSpec.getDefault(), null);
     QueryableIndex queryableIndex1 = closer.register(indexIO.loadIndex(segmentDir1));
 
     IncrementalIndex index2 = closer.register(createIncrementalIndex(aggregators));
     addRows(index2, 100, 200);
-    File segmentDir2 = newFolder(tempFolder, "junit");
+    File segmentDir2 = tempFolder.newFolder();
     indexMerger.persist(index2, segmentDir2, IndexSpec.getDefault(), null);
     QueryableIndex queryableIndex2 = closer.register(indexIO.loadIndex(segmentDir2));
 
@@ -465,8 +465,4 @@ public abstract class BaseSketchBuildSegmentMetadataQueryTest extends Initialize
     return results.get(0).getColumns().get(columnName);
   }
 
-  private static File newFolder(File root, String... subDirs)
-  {
-    return FileUtils.createTempDirInLocation(root.toPath(), String.join("-", subDirs) + "-");
-  }
 }
diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchAggregatorTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchAggregatorTest.java
index 0b886207a04..e1243e39b57 100644
--- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchAggregatorTest.java
+++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchAggregatorTest.java
@@ -78,7 +78,7 @@ public class HllSketchAggregatorTest extends InitializedNullHandlingTest
   public void initHllSketchAggregatorTest(GroupByQueryConfig config, String vectorize, StringEncoding stringEncoding)
   {
     HllSketchModule.registerSerde();
-    groupByHelper = AggregationTestHelper.createGroupByQueryAggregationTestHelperWithTempDir(
+    groupByHelper = AggregationTestHelper.createGroupByQueryAggregationTestHelper(
         new HllSketchModule().getJacksonModules(), config, groupByFolder
     );
     timeseriesHelper = AggregationTestHelper.createTimeseriesQueryAggregationTestHelperWithTempDir(
diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllDoublesSketchAggregatorTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllDoublesSketchAggregatorTest.java
index 0e5e1946151..0a898d6ed5a 100644
--- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllDoublesSketchAggregatorTest.java
+++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllDoublesSketchAggregatorTest.java
@@ -69,7 +69,7 @@ public class KllDoublesSketchAggregatorTest extends InitializedNullHandlingTest
     this.config = config;
     KllSketchModule.registerSerde();
     KllSketchModule module = new KllSketchModule();
-    helper = AggregationTestHelper.createGroupByQueryAggregationTestHelperWithTempDir(
+    helper = AggregationTestHelper.createGroupByQueryAggregationTestHelper(
         module.getJacksonModules(),
         config,
         tempFolder
diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllFloatsSketchAggregatorTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllFloatsSketchAggregatorTest.java
index e06b108fbf7..b453e2e590a 100644
--- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllFloatsSketchAggregatorTest.java
+++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/kll/KllFloatsSketchAggregatorTest.java
@@ -69,7 +69,7 @@ public class KllFloatsSketchAggregatorTest extends InitializedNullHandlingTest
     this.config = config;
     KllSketchModule.registerSerde();
     KllSketchModule module = new KllSketchModule();
-    helper = AggregationTestHelper.createGroupByQueryAggregationTestHelperWithTempDir(
+    helper = AggregationTestHelper.createGroupByQueryAggregationTestHelper(
         module.getJacksonModules(),
         config,
         tempFolder
diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchAggregatorTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchAggregatorTest.java
index 237c91855ba..cc16350f675 100644
--- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchAggregatorTest.java
+++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchAggregatorTest.java
@@ -69,7 +69,7 @@ public class DoublesSketchAggregatorTest extends InitializedNullHandlingTest
     this.config = config;
     DoublesSketchModule.registerSerde();
     DoublesSketchModule module = new DoublesSketchModule();
-    helper = AggregationTestHelper.createGroupByQueryAggregationTestHelperWithTempDir(
+    helper = AggregationTestHelper.createGroupByQueryAggregationTestHelper(
         module.getJacksonModules(),
         config,
         tempFolder
diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/theta/SketchAggregationTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/theta/SketchAggregationTest.java
index 89d8dc4ea70..7834d7d15a8 100644
--- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/theta/SketchAggregationTest.java
+++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/theta/SketchAggregationTest.java
@@ -88,7 +88,7 @@ public class SketchAggregationTest
   public void initSketchAggregationTest(final GroupByQueryConfig config, final String vectorize)
   {
     SketchModule.registerSerde();
-    this.helper = AggregationTestHelper.createGroupByQueryAggregationTestHelperWithTempDir(
+    this.helper = AggregationTestHelper.createGroupByQueryAggregationTestHelper(
         new SketchModule().getJacksonModules(),
         config,
         tempFolder
diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/theta/SketchAggregationWithSimpleDataTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/theta/SketchAggregationWithSimpleDataTest.java
index 2b91000c271..7c8679c6988 100644
--- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/theta/SketchAggregationWithSimpleDataTest.java
+++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/theta/SketchAggregationWithSimpleDataTest.java
@@ -89,7 +89,7 @@ public class SketchAggregationWithSimpleDataTest extends InitializedNullHandling
     SketchModule.registerSerde();
     sm = new SketchModule();
     try (
-        final AggregationTestHelper toolchest = AggregationTestHelper.createGroupByQueryAggregationTestHelperWithTempDir(
+        final AggregationTestHelper toolchest = AggregationTestHelper.createGroupByQueryAggregationTestHelper(
             sm.getJacksonModules(),
             config,
             tempFolder
@@ -140,7 +140,7 @@ public class SketchAggregationWithSimpleDataTest extends InitializedNullHandling
   {
     setup(config);
     try (
-        final AggregationTestHelper gpByQueryAggregationTestHelper = AggregationTestHelper.createGroupByQueryAggregationTestHelperWithTempDir(
+        final AggregationTestHelper gpByQueryAggregationTestHelper = AggregationTestHelper.createGroupByQueryAggregationTestHelper(
             sm.getJacksonModules(),
             config,
             tempFolder
diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/theta/oldapi/OldApiSketchAggregationTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/theta/oldapi/OldApiSketchAggregationTest.java
index b0f1e0d8b29..5bbb156034d 100644
--- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/theta/oldapi/OldApiSketchAggregationTest.java
+++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/theta/oldapi/OldApiSketchAggregationTest.java
@@ -72,7 +72,7 @@ public class OldApiSketchAggregationTest extends InitializedNullHandlingTest
     OldApiSketchModule sm = new OldApiSketchModule();
     sm.configure(null);
 
-    helper = AggregationTestHelper.createGroupByQueryAggregationTestHelperWithTempDir(
+    helper = AggregationTestHelper.createGroupByQueryAggregationTestHelper(
         sm.getJacksonModules(),
         config,
         tempFolder
diff --git a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchAggregationTest.java b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchAggregationTest.java
index 6932d95fd97..50f39a7542c 100755
--- a/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchAggregationTest.java
+++ b/extensions-core/datasketches/src/test/java/org/apache/druid/query/aggregation/datasketches/tuple/ArrayOfDoublesSketchAggregationTest.java
@@ -71,7 +71,7 @@ public class ArrayOfDoublesSketchAggregationTest extends InitializedNullHandling
   {
     ArrayOfDoublesSketchModule.registerSerde();
     DruidModule module = new ArrayOfDoublesSketchModule();
-    helper = AggregationTestHelper.createGroupByQueryAggregationTestHelperWithTempDir(
+    helper = AggregationTestHelper.createGroupByQueryAggregationTestHelper(
         module.getJacksonModules(), config, tempFolder);
     tsHelper = AggregationTestHelper.createTimeseriesQueryAggregationTestHelperWithTempDir(
         module.getJacksonModules(),
diff --git a/extensions-core/druid-basic-security/pom.xml b/extensions-core/druid-basic-security/pom.xml
index 52d94787ef8..fbf1a0d8716 100644
--- a/extensions-core/druid-basic-security/pom.xml
+++ b/extensions-core/druid-basic-security/pom.xml
@@ -119,12 +119,6 @@
     </dependency>
 
     <!-- Tests -->
-    <!-- TestDerbyConnector and MockServiceClient still use JUnit 4 assertions. -->
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
     <dependency>
       <groupId>org.junit.jupiter</groupId>
       <artifactId>junit-jupiter-api</artifactId>
diff --git a/extensions-core/druid-basic-security/src/test/java/org/apache/druid/security/basic/authentication/db/cache/CoordinatorPollingBasicAuthenticatorCacheManagerTest.java b/extensions-core/druid-basic-security/src/test/java/org/apache/druid/security/basic/authentication/db/cache/CoordinatorPollingBasicAuthenticatorCacheManagerTest.java
index 0e92c051f2a..35cdeb70d45 100644
--- a/extensions-core/druid-basic-security/src/test/java/org/apache/druid/security/basic/authentication/db/cache/CoordinatorPollingBasicAuthenticatorCacheManagerTest.java
+++ b/extensions-core/druid-basic-security/src/test/java/org/apache/druid/security/basic/authentication/db/cache/CoordinatorPollingBasicAuthenticatorCacheManagerTest.java
@@ -20,7 +20,6 @@
 package org.apache.druid.security.basic.authentication.db.cache;
 
 import com.google.inject.Injector;
-import org.apache.druid.java.util.common.FileUtils;
 import org.apache.druid.java.util.common.StringUtils;
 import org.apache.druid.java.util.emitter.EmittingLogger;
 import org.apache.druid.java.util.metrics.StubServiceEmitter;
@@ -30,6 +29,7 @@ import org.apache.druid.security.basic.BasicAuthCommonCacheConfig;
 import org.apache.druid.security.basic.authentication.BasicHTTPAuthenticator;
 import org.apache.druid.segment.TestHelper;
 import org.apache.druid.server.security.AuthenticatorMapper;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.easymock.EasyMock;
 import org.jboss.netty.buffer.ChannelBuffer;
 import org.jboss.netty.handler.codec.http.DefaultHttpResponse;
@@ -38,12 +38,11 @@ import org.jboss.netty.handler.codec.http.HttpResponseStatus;
 import org.jboss.netty.handler.codec.http.HttpVersion;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.MediaType;
 
-import java.io.File;
 import java.io.IOException;
 import java.util.Map;
 import java.util.concurrent.CountDownLatch;
@@ -51,8 +50,8 @@ import java.util.concurrent.TimeUnit;
 
 public class CoordinatorPollingBasicAuthenticatorCacheManagerTest
 {
-  @TempDir
-  public File temporaryFolder;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   @Test
   public void test_stop_interruptsPollingThread() throws InterruptedException, IOException
@@ -107,7 +106,7 @@ public class CoordinatorPollingBasicAuthenticatorCacheManagerTest
     final int numRetries = 10;
     final CoordinatorPollingBasicAuthenticatorCacheManager manager = new CoordinatorPollingBasicAuthenticatorCacheManager(
         injector,
-        new BasicAuthCommonCacheConfig(0L, 1L, newFolder(temporaryFolder, "junit").getAbsolutePath(), numRetries),
+        new BasicAuthCommonCacheConfig(0L, 1L, temporaryFolder.newFolder().getAbsolutePath(), numRetries),
         TestHelper.JSON_MAPPER,
         serviceClient
     );
@@ -123,9 +122,4 @@ public class CoordinatorPollingBasicAuthenticatorCacheManagerTest
     EasyMock.verify(injector);
   }
 
-  private static File newFolder(File root, String... subDirs)
-  {
-    return FileUtils.createTempDirInLocation(root.toPath(), String.join("-", subDirs));
-  }
-
 }
diff --git a/extensions-core/druid-basic-security/src/test/java/org/apache/druid/security/basic/authorization/db/cache/CoordinatorPollingBasicAuthorizerCacheManagerTest.java b/extensions-core/druid-basic-security/src/test/java/org/apache/druid/security/basic/authorization/db/cache/CoordinatorPollingBasicAuthorizerCacheManagerTest.java
index bac51c3770c..a9b59b0cb76 100644
--- a/extensions-core/druid-basic-security/src/test/java/org/apache/druid/security/basic/authorization/db/cache/CoordinatorPollingBasicAuthorizerCacheManagerTest.java
+++ b/extensions-core/druid-basic-security/src/test/java/org/apache/druid/security/basic/authorization/db/cache/CoordinatorPollingBasicAuthorizerCacheManagerTest.java
@@ -21,7 +21,6 @@ package org.apache.druid.security.basic.authorization.db.cache;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.google.inject.Injector;
-import org.apache.druid.java.util.common.FileUtils;
 import org.apache.druid.java.util.common.StringUtils;
 import org.apache.druid.java.util.common.jackson.JacksonUtils;
 import org.apache.druid.java.util.emitter.EmittingLogger;
@@ -35,6 +34,7 @@ import org.apache.druid.security.basic.authorization.entity.GroupMappingAndRoleM
 import org.apache.druid.security.basic.authorization.entity.UserAndRoleMap;
 import org.apache.druid.segment.TestHelper;
 import org.apache.druid.server.security.AuthorizerMapper;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.easymock.EasyMock;
 import org.easymock.IAnswer;
 import org.jboss.netty.buffer.ChannelBuffer;
@@ -47,9 +47,8 @@ import org.jboss.netty.handler.codec.http.HttpVersion;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
-import java.io.File;
 import java.io.IOException;
 import java.util.Map;
 import java.util.concurrent.CountDownLatch;
@@ -60,8 +59,8 @@ public class CoordinatorPollingBasicAuthorizerCacheManagerTest
   private static final ObjectMapper MAPPER = TestHelper.JSON_MAPPER;
   private static final String AUTHORIZER_NAME = "test-basic-auth";
 
-  @TempDir
-  public File temporaryFolder;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   // Mocks
   private Injector injector;
@@ -84,7 +83,7 @@ public class CoordinatorPollingBasicAuthorizerCacheManagerTest
     final int numRetries = 1;
     manager = new CoordinatorPollingBasicAuthorizerCacheManager(
         injector,
-        new BasicAuthCommonCacheConfig(0L, 1L, newFolder(temporaryFolder, "junit").getAbsolutePath(), numRetries),
+        new BasicAuthCommonCacheConfig(0L, 1L, temporaryFolder.newFolder().getAbsolutePath(), numRetries),
         MAPPER,
         serviceClient
     );
@@ -217,8 +216,4 @@ public class CoordinatorPollingBasicAuthorizerCacheManagerTest
     );
   }
 
-  private static File newFolder(File root, String... subDirs)
-  {
-    return FileUtils.createTempDirInLocation(root.toPath(), String.join("-", subDirs));
-  }
 }
diff --git a/extensions-core/druid-bloom-filter/pom.xml b/extensions-core/druid-bloom-filter/pom.xml
index 56d9f8f3946..d628eb19f3e 100644
--- a/extensions-core/druid-bloom-filter/pom.xml
+++ b/extensions-core/druid-bloom-filter/pom.xml
@@ -109,11 +109,6 @@
     </dependency>
 
     <!-- Tests -->
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
     <dependency>
       <groupId>org.junit.jupiter</groupId>
       <artifactId>junit-jupiter-api</artifactId>
diff --git a/extensions-core/druid-bloom-filter/src/test/java/org/apache/druid/query/aggregation/bloom/BloomFilterGroupByQueryTest.java b/extensions-core/druid-bloom-filter/src/test/java/org/apache/druid/query/aggregation/bloom/BloomFilterGroupByQueryTest.java
index 2ba0ee63e59..68411746d1a 100644
--- a/extensions-core/druid-bloom-filter/src/test/java/org/apache/druid/query/aggregation/bloom/BloomFilterGroupByQueryTest.java
+++ b/extensions-core/druid-bloom-filter/src/test/java/org/apache/druid/query/aggregation/bloom/BloomFilterGroupByQueryTest.java
@@ -78,7 +78,7 @@ public class BloomFilterGroupByQueryTest extends InitializedNullHandlingTest
 
   public void initBloomFilterGroupByQueryTest(final GroupByQueryConfig config)
   {
-    helper = AggregationTestHelper.createGroupByQueryAggregationTestHelperWithTempDir(
+    helper = AggregationTestHelper.createGroupByQueryAggregationTestHelper(
         Lists.newArrayList(MODULE.getJacksonModules()),
         config,
         tempFolder
diff --git a/extensions-core/druid-catalog/pom.xml b/extensions-core/druid-catalog/pom.xml
index 231f17a7518..b3c3a27619d 100644
--- a/extensions-core/druid-catalog/pom.xml
+++ b/extensions-core/druid-catalog/pom.xml
@@ -153,12 +153,6 @@
         </dependency>
 
         <!-- Tests -->
-        <!-- TestDerbyConnector still uses JUnit 4 assertions during cleanup. -->
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
         <dependency>
             <groupId>org.junit.jupiter</groupId>
             <artifactId>junit-jupiter-api</artifactId>
diff --git a/extensions-core/druid-testcontainers/pom.xml b/extensions-core/druid-testcontainers/pom.xml
index 59a9f2370e9..98c74b21930 100644
--- a/extensions-core/druid-testcontainers/pom.xml
+++ b/extensions-core/druid-testcontainers/pom.xml
@@ -41,11 +41,6 @@
       <artifactId>testcontainers</artifactId>
       <scope>compile</scope>
     </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>provided</scope>
-    </dependency>
   </dependencies>
 
   <build>
diff --git a/extensions-core/google-extensions/src/test/java/org/apache/druid/storage/google/output/GoogleOutputConfigTest.java b/extensions-core/google-extensions/src/test/java/org/apache/druid/storage/google/output/GoogleOutputConfigTest.java
index 1213829f5c5..812ef43ec10 100644
--- a/extensions-core/google-extensions/src/test/java/org/apache/druid/storage/google/output/GoogleOutputConfigTest.java
+++ b/extensions-core/google-extensions/src/test/java/org/apache/druid/storage/google/output/GoogleOutputConfigTest.java
@@ -21,19 +21,17 @@ package org.apache.druid.storage.google.output;
 
 
 import org.apache.druid.error.DruidException;
-import org.apache.druid.java.util.common.FileUtils;
 import org.apache.druid.java.util.common.HumanReadableBytes;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
-
-import java.io.File;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 public class GoogleOutputConfigTest
 {
 
-  @TempDir
-  public File temporaryFolder;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   private static final String BUCKET = "bucket";
   private static final String PREFIX = "prefix";
@@ -45,12 +43,8 @@ public class GoogleOutputConfigTest
     HumanReadableBytes chunkSize = new HumanReadableBytes("17MiB");
     Assertions.assertThrows(
         DruidException.class,
-        () -> new GoogleOutputConfig(BUCKET, PREFIX, newFolder(temporaryFolder, "junit"), chunkSize, MAX_RETRY_COUNT)
+        () -> new GoogleOutputConfig(BUCKET, PREFIX, temporaryFolder.newFolder(), chunkSize, MAX_RETRY_COUNT)
     );
   }
 
-  private static File newFolder(File root, String... subDirs)
-  {
-    return FileUtils.createTempDirInLocation(root.toPath(), String.join("-", subDirs));
-  }
 }
diff --git a/extensions-core/google-extensions/src/test/java/org/apache/druid/storage/google/output/GoogleStorageConnectorTest.java b/extensions-core/google-extensions/src/test/java/org/apache/druid/storage/google/output/GoogleStorageConnectorTest.java
index d1891b66601..1b29fbc5447 100644
--- a/extensions-core/google-extensions/src/test/java/org/apache/druid/storage/google/output/GoogleStorageConnectorTest.java
+++ b/extensions-core/google-extensions/src/test/java/org/apache/druid/storage/google/output/GoogleStorageConnectorTest.java
@@ -23,20 +23,19 @@ import com.google.cloud.storage.StorageException;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Lists;
 import org.apache.commons.io.IOUtils;
-import org.apache.druid.java.util.common.FileUtils;
 import org.apache.druid.java.util.common.HumanReadableBytes;
 import org.apache.druid.storage.google.GoogleInputDataConfig;
 import org.apache.druid.storage.google.GoogleStorage;
 import org.apache.druid.storage.google.GoogleStorageObjectMetadata;
 import org.apache.druid.storage.google.GoogleStorageObjectPage;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.easymock.Capture;
 import org.easymock.EasyMock;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
-import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.nio.charset.StandardCharsets;
@@ -47,8 +46,8 @@ public class GoogleStorageConnectorTest
   private static final String BUCKET = "BUCKET";
   private static final String PREFIX = "PREFIX";
   private static final String TEST_FILE = "TEST_FILE";
-  @TempDir
-  public File temporaryFolder;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   private static final int MAX_LISTING_LEN = 10;
 
@@ -62,7 +61,7 @@ public class GoogleStorageConnectorTest
   @BeforeEach
   public void setUp() throws IOException
   {
-    GoogleOutputConfig config = new GoogleOutputConfig(BUCKET, PREFIX, newFolder(temporaryFolder, "junit"), CHUNK_SIZE, null);
+    GoogleOutputConfig config = new GoogleOutputConfig(BUCKET, PREFIX, temporaryFolder.newFolder(), CHUNK_SIZE, null);
     GoogleInputDataConfig inputDataConfig = new GoogleInputDataConfig();
     inputDataConfig.setMaxListingLength(MAX_LISTING_LEN);
     googleStorageConnector = new GoogleStorageConnector(config, googleStorage, inputDataConfig);
@@ -430,8 +429,4 @@ public class GoogleStorageConnectorTest
 
   }
 
-  private static File newFolder(File root, String... subDirs)
-  {
-    return FileUtils.createTempDirInLocation(root.toPath(), String.join("-", subDirs));
-  }
 }
diff --git a/extensions-core/hdfs-storage/src/test/java/org/apache/druid/indexing/common/tasklogs/HdfsTaskLogsTest.java b/extensions-core/hdfs-storage/src/test/java/org/apache/druid/indexing/common/tasklogs/HdfsTaskLogsTest.java
index 8c87c2f6c26..8e3db1290b1 100644
--- a/extensions-core/hdfs-storage/src/test/java/org/apache/druid/indexing/common/tasklogs/HdfsTaskLogsTest.java
+++ b/extensions-core/hdfs-storage/src/test/java/org/apache/druid/indexing/common/tasklogs/HdfsTaskLogsTest.java
@@ -22,17 +22,17 @@ package org.apache.druid.indexing.common.tasklogs;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.io.ByteStreams;
 import com.google.common.io.Files;
-import org.apache.druid.java.util.common.FileUtils;
 import org.apache.druid.java.util.common.StringUtils;
 import org.apache.druid.storage.hdfs.tasklog.HdfsTaskLogs;
 import org.apache.druid.storage.hdfs.tasklog.HdfsTaskLogsConfig;
 import org.apache.druid.tasklogs.TaskLogs;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.File;
 import java.io.IOException;
@@ -41,13 +41,13 @@ import java.util.Map;
 
 public class HdfsTaskLogsTest
 {
-  @TempDir
-  public File tempFolder;
+  @RegisterExtension
+  public final TemporaryFolderExtension tempFolder = TemporaryFolderExtension.testCaseScoped();
 
   @Test
   public void testStream() throws Exception
   {
-    final File tmpDir = newFolder(tempFolder, "junit");
+    final File tmpDir = tempFolder.newFolder();
     final File logDir = new File(tmpDir, "logs");
     final File logFile = new File(tmpDir, "log");
     Files.asCharSink(logFile, StandardCharsets.UTF_8).write("blah");
@@ -64,7 +64,7 @@ public class HdfsTaskLogsTest
   @Test
   public void testOverwrite() throws Exception
   {
-    final File tmpDir = newFolder(tempFolder, "junit");
+    final File tmpDir = tempFolder.newFolder();
     final File logDir = new File(tmpDir, "logs");
     final File logFile = new File(tmpDir, "log");
     final TaskLogs taskLogs = new HdfsTaskLogs(new HdfsTaskLogsConfig(logDir.toString()), new Configuration());
@@ -81,7 +81,7 @@ public class HdfsTaskLogsTest
   @Test
   public void test_taskStatus() throws Exception
   {
-    final File tmpDir = newFolder(tempFolder, "junit");
+    final File tmpDir = tempFolder.newFolder();
     final File logDir = new File(tmpDir, "logs");
     final File statusFile = new File(tmpDir, "status.json");
     final TaskLogs taskLogs = new HdfsTaskLogs(new HdfsTaskLogsConfig(logDir.toString()), new Configuration());
@@ -98,7 +98,7 @@ public class HdfsTaskLogsTest
   @Test
   public void test_taskPayload() throws Exception
   {
-    final File tmpDir = newFolder(tempFolder, "junit");
+    final File tmpDir = tempFolder.newFolder();
     final File logDir = new File(tmpDir, "logs");
     final File payload = new File(tmpDir, "payload.json");
     final TaskLogs taskLogs = new HdfsTaskLogs(new HdfsTaskLogsConfig(logDir.toString()), new Configuration());
@@ -111,7 +111,7 @@ public class HdfsTaskLogsTest
   @Test
   public void testKill() throws Exception
   {
-    final File tmpDir = newFolder(tempFolder, "junit");
+    final File tmpDir = tempFolder.newFolder();
     final File logDir = new File(tmpDir, "logs");
     final File logFile = new File(tmpDir, "log");
 
@@ -148,8 +148,4 @@ public class HdfsTaskLogsTest
     return StringUtils.fromUtf8(ByteStreams.toByteArray(taskLogs.streamTaskLog(logFile, offset).get()));
   }
 
-  private static File newFolder(File root, String... subDirs)
-  {
-    return FileUtils.createTempDirInLocation(root.toPath(), String.join("-", subDirs));
-  }
 }
diff --git a/extensions-core/hdfs-storage/src/test/java/org/apache/druid/storage/hdfs/HdfsDataSegmentPusherTest.java b/extensions-core/hdfs-storage/src/test/java/org/apache/druid/storage/hdfs/HdfsDataSegmentPusherTest.java
index 2508771cd6b..edbe31c72fc 100644
--- a/extensions-core/hdfs-storage/src/test/java/org/apache/druid/storage/hdfs/HdfsDataSegmentPusherTest.java
+++ b/extensions-core/hdfs-storage/src/test/java/org/apache/druid/storage/hdfs/HdfsDataSegmentPusherTest.java
@@ -33,9 +33,9 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.io.Files;
 import org.apache.druid.jackson.GranularityModule;
-import org.apache.druid.java.util.common.FileUtils;
 import org.apache.druid.java.util.common.Intervals;
 import org.apache.druid.java.util.common.StringUtils;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.apache.druid.timeline.DataSegment;
 import org.apache.druid.timeline.DataSegment.PruneSpecsHolder;
 import org.apache.druid.timeline.partition.NoneShardSpec;
@@ -48,7 +48,7 @@ import org.joda.time.Interval;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.File;
 import java.io.IOException;
@@ -74,8 +74,8 @@ public class HdfsDataSegmentPusherTest
     objectMapper.setInjectableValues(injectableValues);
   }
 
-  @TempDir
-  public File tempFolder;
+  @RegisterExtension
+  public final TemporaryFolderExtension tempFolder = TemporaryFolderExtension.testCaseScoped();
 
   private HdfsDataSegmentPusher hdfsDataSegmentPusher;
 
@@ -124,7 +124,7 @@ public class HdfsDataSegmentPusherTest
     Configuration conf = new Configuration(true);
 
     // Create a mock segment on disk
-    File segmentDir = newFolder(tempFolder);
+    File segmentDir = tempFolder.newFolder();
     File tmp = new File(segmentDir, "version.bin");
 
     final byte[] data = new byte[]{0x0, 0x0, 0x0, 0x1};
@@ -132,7 +132,7 @@ public class HdfsDataSegmentPusherTest
     final long size = data.length;
 
     HdfsDataSegmentPusherConfig config = new HdfsDataSegmentPusherConfig();
-    final File storageDirectory = newFolder(tempFolder);
+    final File storageDirectory = tempFolder.newFolder();
 
     config.setStorageDirectory(StringUtils.format("file://%s", storageDirectory.getAbsolutePath()));
     HdfsDataSegmentPusher pusher = new HdfsDataSegmentPusher(config, conf);
@@ -165,7 +165,7 @@ public class HdfsDataSegmentPusherTest
     Configuration conf = new Configuration(true);
 
     // Create a mock segment on disk
-    File segmentDir = newFolder(tempFolder);
+    File segmentDir = tempFolder.newFolder();
     File tmp = new File(segmentDir, "version.bin");
 
     final byte[] data = new byte[]{0x0, 0x0, 0x0, 0x1};
@@ -173,7 +173,7 @@ public class HdfsDataSegmentPusherTest
     final long size = data.length;
 
     HdfsDataSegmentPusherConfig config = new HdfsDataSegmentPusherConfig();
-    final File storageDirectory = newFolder(tempFolder);
+    final File storageDirectory = tempFolder.newFolder();
 
     config.setStorageDirectory(StringUtils.format("file://%s", storageDirectory.getAbsolutePath()));
     HdfsDataSegmentPusher pusher = new HdfsDataSegmentPusher(config, conf);
@@ -205,7 +205,7 @@ public class HdfsDataSegmentPusherTest
     DataSegment[] segments = new DataSegment[numberOfSegments];
 
     // Create a mock segment on disk
-    File segmentDir = newFolder(tempFolder);
+    File segmentDir = tempFolder.newFolder();
     File tmp = new File(segmentDir, "version.bin");
 
     final byte[] data = new byte[]{0x0, 0x0, 0x0, 0x1};
@@ -213,7 +213,7 @@ public class HdfsDataSegmentPusherTest
     final long size = data.length;
 
     HdfsDataSegmentPusherConfig config = new HdfsDataSegmentPusherConfig();
-    final File storageDirectory = newFolder(tempFolder);
+    final File storageDirectory = tempFolder.newFolder();
 
     config.setCompressionFormat(format);
     config.setStorageDirectory(
@@ -241,13 +241,16 @@ public class HdfsDataSegmentPusherTest
     for (int i = 0; i < numberOfSegments; i++) {
       final DataSegment pushedSegment = pusher.push(segmentDir, segments[i], false);
 
-      String indexUri = StringUtils.format(
-          "%s/%s/%d_index.%s",
-          FileSystem.newInstance(conf).makeQualified(new Path(config.getStorageDirectory())).toUri().toString(),
-          pusher.getStorageDir(segments[i], false),
-          segments[i].getShardSpec().getPartitionNum(),
-          format.getExtension()
-      );
+      final String indexUri;
+      try (FileSystem fileSystem = FileSystem.newInstance(conf)) {
+        indexUri = StringUtils.format(
+            "%s/%s/%d_index.%s",
+            fileSystem.makeQualified(new Path(config.getStorageDirectory())).toUri().toString(),
+            pusher.getStorageDir(segments[i], false),
+            segments[i].getShardSpec().getPartitionNum(),
+            format.getExtension()
+        );
+      }
 
       Assertions.assertEquals(segments[i].getSize(), pushedSegment.getSize());
       Assertions.assertEquals(segments[i], pushedSegment);
@@ -283,14 +286,17 @@ public class HdfsDataSegmentPusherTest
 
 
       // push twice will fail and temp dir cleaned
-      File outDir = new File(StringUtils.format("%s/%s", config.getStorageDirectory(), segmentPath));
-      outDir.setReadOnly();
+      final File outDir = new File(storageDirectory, segmentPath);
+      Assertions.assertTrue(outDir.setReadOnly(), "test setup must be able to make the output directory read-only");
       try {
         pusher.push(segmentDir, segments[i], false);
       }
       catch (IOException e) {
         Assertions.fail("should not throw exception");
       }
+      finally {
+        Assertions.assertTrue(outDir.setWritable(true), "test teardown must restore write permission");
+      }
     }
   }
 
@@ -299,7 +305,7 @@ public class HdfsDataSegmentPusherTest
     Configuration conf = new Configuration(true);
 
     // Create a mock segment on disk
-    File segmentDir = newFolder(tempFolder);
+    File segmentDir = tempFolder.newFolder();
     File tmp = new File(segmentDir, "version.bin");
 
     final byte[] data = new byte[]{0x0, 0x0, 0x0, 0x1};
@@ -307,7 +313,7 @@ public class HdfsDataSegmentPusherTest
     final long size = data.length;
 
     HdfsDataSegmentPusherConfig config = new HdfsDataSegmentPusherConfig();
-    final File storageDirectory = newFolder(tempFolder);
+    final File storageDirectory = tempFolder.newFolder();
 
     config.setStorageDirectory(
         scheme != null
@@ -331,12 +337,15 @@ public class HdfsDataSegmentPusherTest
     DataSegment segment = pusher.push(segmentDir, segmentToPush, false);
 
 
-    String indexUri = StringUtils.format(
-        "%s/%s/%d_index.zip",
-        FileSystem.newInstance(conf).makeQualified(new Path(config.getStorageDirectory())).toUri().toString(),
-        pusher.getStorageDir(segmentToPush, false),
-        segmentToPush.getShardSpec().getPartitionNum()
-    );
+    final String indexUri;
+    try (FileSystem fileSystem = FileSystem.newInstance(conf)) {
+      indexUri = StringUtils.format(
+          "%s/%s/%d_index.zip",
+          fileSystem.makeQualified(new Path(config.getStorageDirectory())).toUri().toString(),
+          pusher.getStorageDir(segmentToPush, false),
+          segmentToPush.getShardSpec().getPartitionNum()
+      );
+    }
 
     Assertions.assertEquals(segmentToPush.getSize(), segment.getSize());
     Assertions.assertEquals(segmentToPush, segment);
@@ -358,14 +367,17 @@ public class HdfsDataSegmentPusherTest
     Assertions.assertTrue(indexFile.exists());
 
     // push twice will fail and temp dir cleaned
-    File outDir = new File(StringUtils.format("%s/%s", config.getStorageDirectory(), segmentPath));
-    outDir.setReadOnly();
+    final File outDir = new File(storageDirectory, segmentPath);
+    Assertions.assertTrue(outDir.setReadOnly(), "test setup must be able to make the output directory read-only");
     try {
       pusher.push(segmentDir, segmentToPush, false);
     }
     catch (IOException e) {
       Assertions.fail("should not throw exception");
     }
+    finally {
+      Assertions.assertTrue(outDir.setWritable(true), "test teardown must restore write permission");
+    }
   }
 
   public static class TestObjectMapper extends ObjectMapper
@@ -430,8 +442,4 @@ public class HdfsDataSegmentPusherTest
 
   }
 
-  private static File newFolder(File root)
-  {
-    return FileUtils.createTempDirInLocation(root.toPath(), "junit");
-  }
 }
diff --git a/extensions-core/histogram/pom.xml b/extensions-core/histogram/pom.xml
index cf41d1687ce..d9d4aefacc4 100644
--- a/extensions-core/histogram/pom.xml
+++ b/extensions-core/histogram/pom.xml
@@ -93,11 +93,6 @@
         </dependency>
 
         <!-- Tests -->
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
         <dependency>
             <groupId>org.junit.jupiter</groupId>
             <artifactId>junit-jupiter-api</artifactId>
@@ -108,11 +103,6 @@
             <artifactId>junit-jupiter-engine</artifactId>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>org.junit.jupiter</groupId>
-            <artifactId>junit-jupiter-migrationsupport</artifactId>
-            <scope>test</scope>
-        </dependency>
         <dependency>
             <groupId>org.junit.jupiter</groupId>
             <artifactId>junit-jupiter-params</artifactId>
diff --git a/extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogramAggregationTest.java b/extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogramAggregationTest.java
index aa80da3a40d..cb551ee7dcf 100644
--- a/extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogramAggregationTest.java
+++ b/extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogramAggregationTest.java
@@ -60,7 +60,7 @@ public class ApproximateHistogramAggregationTest extends InitializedNullHandling
   public void initApproximateHistogramAggregationTest(final GroupByQueryConfig config)
   {
     ApproximateHistogramDruidModule.registerSerde();
-    helper = AggregationTestHelper.createGroupByQueryAggregationTestHelperWithTempDir(
+    helper = AggregationTestHelper.createGroupByQueryAggregationTestHelper(
         Lists.newArrayList(new ApproximateHistogramDruidModule().getJacksonModules()),
         config,
         tempFolder
diff --git a/extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/FixedBucketsHistogramAggregationTest.java b/extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/FixedBucketsHistogramAggregationTest.java
index 6f6178add8e..b194066a9a4 100644
--- a/extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/FixedBucketsHistogramAggregationTest.java
+++ b/extensions-core/histogram/src/test/java/org/apache/druid/query/aggregation/histogram/FixedBucketsHistogramAggregationTest.java
@@ -63,7 +63,7 @@ public class FixedBucketsHistogramAggregationTest extends InitializedNullHandlin
   public void initFixedBucketsHistogramAggregationTest(final GroupByQueryConfig config)
   {
     ApproximateHistogramDruidModule.registerSerde();
-    helper = AggregationTestHelper.createGroupByQueryAggregationTestHelperWithTempDir(
+    helper = AggregationTestHelper.createGroupByQueryAggregationTestHelper(
         Lists.newArrayList(new ApproximateHistogramDruidModule().getJacksonModules()),
         config,
         tempFolder
diff --git a/extensions-core/kafka-indexing-service/pom.xml b/extensions-core/kafka-indexing-service/pom.xml
index bd1cdc53cf2..d5b03047faf 100644
--- a/extensions-core/kafka-indexing-service/pom.xml
+++ b/extensions-core/kafka-indexing-service/pom.xml
@@ -125,11 +125,6 @@
     </dependency>
 
     <!-- Tests -->
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
     <dependency>
       <groupId>org.junit.jupiter</groupId>
       <artifactId>junit-jupiter</artifactId>
@@ -220,6 +215,11 @@
       <artifactId>junit-jupiter-params</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.hamcrest</groupId>
+      <artifactId>hamcrest</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <build>
diff --git a/extensions-core/kafka-indexing-service/src/test/java/org/apache/druid/indexing/kafka/KafkaIndexTaskTest.java b/extensions-core/kafka-indexing-service/src/test/java/org/apache/druid/indexing/kafka/KafkaIndexTaskTest.java
index 876bd937104..f72fe6cc640 100644
--- a/extensions-core/kafka-indexing-service/src/test/java/org/apache/druid/indexing/kafka/KafkaIndexTaskTest.java
+++ b/extensions-core/kafka-indexing-service/src/test/java/org/apache/druid/indexing/kafka/KafkaIndexTaskTest.java
@@ -151,7 +151,6 @@ import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.Timeout;
-import org.junit.jupiter.api.io.TempDir;
 import org.junit.jupiter.params.ParameterizedClass;
 import org.junit.jupiter.params.provider.MethodSource;
 
@@ -181,9 +180,6 @@ import java.util.stream.Stream;
 @MethodSource("constructorFeeder")
 public class KafkaIndexTaskTest extends SeekableStreamIndexTaskTestBase
 {
-  @TempDir
-  public File temporaryFolder;
-
   private static final long POLL_RETRY_MS = 100;
   private static final Iterable<Header> SAMPLE_HEADERS = ImmutableList.of(new Header()
   {
@@ -3005,7 +3001,7 @@ public class KafkaIndexTaskTest extends SeekableStreamIndexTaskTestBase
 
   private void makeToolboxFactory() throws IOException
   {
-    directory = newFolder(temporaryFolder, "junit");
+    directory = temporaryFolder.newFolder();
     final TestUtils testUtils = new TestUtils();
     final ObjectMapper objectMapper = testUtils.getTestObjectMapper();
 
@@ -3432,7 +3428,7 @@ public class KafkaIndexTaskTest extends SeekableStreamIndexTaskTestBase
         )
     );
 
-    final File file = new File(temporaryFolder, "task.json");
+    final File file = new File(temporaryFolder.getRoot(), "task.json");
 
     FileUtils.write(file, OBJECT_MAPPER.writeValueAsString(task), StandardCharsets.UTF_8);
 
@@ -3679,7 +3675,7 @@ public class KafkaIndexTaskTest extends SeekableStreamIndexTaskTestBase
 
   private Injector makePeonInjectorWithStubEmitter(Task task) throws IOException
   {
-    final File taskFile = new File(super.tempFolder, "task.json");
+    final File taskFile = new File(temporaryFolder.getRoot(), "task.json");
     FileUtils.write(taskFile, OBJECT_MAPPER.writeValueAsString(task), StandardCharsets.UTF_8);
 
     final Properties properties = new Properties();
@@ -3712,11 +3708,4 @@ public class KafkaIndexTaskTest extends SeekableStreamIndexTaskTestBase
     return peon.makeInjector(Set.of(NodeRole.PEON));
   }
 
-  private static File newFolder(File root, String... subDirs)
-  {
-    return org.apache.druid.java.util.common.FileUtils.createTempDirInLocation(
-        root.toPath(),
-        String.join("-", subDirs)
-    );
-  }
 }
diff --git a/extensions-core/kinesis-indexing-service/pom.xml b/extensions-core/kinesis-indexing-service/pom.xml
index 8c7c102956a..934bbb1e33c 100644
--- a/extensions-core/kinesis-indexing-service/pom.xml
+++ b/extensions-core/kinesis-indexing-service/pom.xml
@@ -175,11 +175,6 @@
             <artifactId>easymock</artifactId>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
         <dependency>
             <groupId>org.junit.jupiter</groupId>
             <artifactId>junit-jupiter</artifactId>
diff --git a/extensions-core/kinesis-indexing-service/src/test/java/org/apache/druid/indexing/kinesis/KinesisIndexTaskTest.java b/extensions-core/kinesis-indexing-service/src/test/java/org/apache/druid/indexing/kinesis/KinesisIndexTaskTest.java
index 6f6f1d92133..832839e528c 100644
--- a/extensions-core/kinesis-indexing-service/src/test/java/org/apache/druid/indexing/kinesis/KinesisIndexTaskTest.java
+++ b/extensions-core/kinesis-indexing-service/src/test/java/org/apache/druid/indexing/kinesis/KinesisIndexTaskTest.java
@@ -2436,7 +2436,7 @@ public class KinesisIndexTaskTest extends SeekableStreamIndexTaskTestBase
 
   private void makeToolboxFactory() throws IOException
   {
-    directory = newFolder(tempFolder, "junit");
+    directory = newFolder(temporaryFolder.getRoot(), "junit");
     final TestUtils testUtils = new TestUtils();
     final ObjectMapper objectMapper = testUtils.getTestObjectMapper();
     objectMapper.setInjectableValues(((InjectableValues.Std) objectMapper.getInjectableValues()).addValue(
diff --git a/extensions-core/lookups-cached-single/pom.xml b/extensions-core/lookups-cached-single/pom.xml
index 84d2b46b7da..ec80d925639 100644
--- a/extensions-core/lookups-cached-single/pom.xml
+++ b/extensions-core/lookups-cached-single/pom.xml
@@ -92,12 +92,6 @@
     </dependency>
 
     <!-- Tests -->
-    <!-- TestDerbyConnector uses JUnit 4 assertions during cleanup. -->
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
     <dependency>
       <groupId>org.junit.jupiter</groupId>
       <artifactId>junit-jupiter</artifactId>
diff --git a/extensions-core/orc-extensions/src/test/java/org/apache/druid/data/input/orc/OrcReaderTest.java b/extensions-core/orc-extensions/src/test/java/org/apache/druid/data/input/orc/OrcReaderTest.java
index 8c415e9ec84..71f73117b13 100644
--- a/extensions-core/orc-extensions/src/test/java/org/apache/druid/data/input/orc/OrcReaderTest.java
+++ b/extensions-core/orc-extensions/src/test/java/org/apache/druid/data/input/orc/OrcReaderTest.java
@@ -32,7 +32,6 @@ import org.apache.druid.data.input.impl.FileEntity;
 import org.apache.druid.data.input.impl.StringDimensionSchema;
 import org.apache.druid.data.input.impl.TimestampSpec;
 import org.apache.druid.java.util.common.DateTimes;
-import org.apache.druid.java.util.common.FileUtils;
 import org.apache.druid.java.util.common.parsers.CloseableIterator;
 import org.apache.druid.java.util.common.parsers.JSONPathFieldSpec;
 import org.apache.druid.java.util.common.parsers.JSONPathFieldType;
@@ -43,10 +42,11 @@ import org.apache.druid.segment.transform.ExpressionTransform;
 import org.apache.druid.segment.transform.TransformSpec;
 import org.apache.druid.segment.transform.TransformingInputEntityReader;
 import org.apache.druid.testing.InitializedNullHandlingTest;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.apache.hadoop.conf.Configuration;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.File;
 import java.io.IOException;
@@ -55,8 +55,8 @@ import java.util.List;
 
 public class OrcReaderTest extends InitializedNullHandlingTest
 {
-  @TempDir
-  public File temporaryFolder;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   @Test
   public void testTest1() throws IOException
@@ -433,7 +433,7 @@ public class OrcReaderTest extends InitializedNullHandlingTest
     );
     final FileEntity entity = new FileEntity(new File("example/orc-file-11-format.orc"));
 
-    final InputEntityReader reader = inputFormat.createReader(schema, entity, newFolder(temporaryFolder, "junit"));
+    final InputEntityReader reader = inputFormat.createReader(schema, entity, temporaryFolder.newFolder());
 
     List<String> dims = ImmutableList.of(
         "boolean1",
@@ -707,15 +707,10 @@ public class OrcReaderTest extends InitializedNullHandlingTest
       DimensionsSpec dimensionsSpec,
       InputFormat inputFormat,
       String dataFile
-  )
+  ) throws IOException
   {
     final InputRowSchema schema = new InputRowSchema(timestampSpec, dimensionsSpec, ColumnsFilter.all());
     final FileEntity entity = new FileEntity(new File(dataFile));
-    return inputFormat.createReader(schema, entity, newFolder(temporaryFolder, "junit"));
-  }
-
-  private static File newFolder(File root, String... subDirs)
-  {
-    return FileUtils.createTempDirInLocation(root.toPath(), String.join("-", subDirs));
+    return inputFormat.createReader(schema, entity, temporaryFolder.newFolder());
   }
 }
diff --git a/extensions-core/parquet-extensions/src/test/java/org/apache/druid/data/input/parquet/ParquetReaderResourceLeakTest.java b/extensions-core/parquet-extensions/src/test/java/org/apache/druid/data/input/parquet/ParquetReaderResourceLeakTest.java
index 2c8d04ff3bc..728494b8cd8 100644
--- a/extensions-core/parquet-extensions/src/test/java/org/apache/druid/data/input/parquet/ParquetReaderResourceLeakTest.java
+++ b/extensions-core/parquet-extensions/src/test/java/org/apache/druid/data/input/parquet/ParquetReaderResourceLeakTest.java
@@ -31,10 +31,11 @@ import org.apache.druid.java.util.common.FileUtils;
 import org.apache.druid.java.util.common.StringUtils;
 import org.apache.druid.java.util.common.parsers.CloseableIterator;
 import org.apache.druid.java.util.common.parsers.JSONPathSpec;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.apache.hadoop.conf.Configuration;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.File;
 import java.io.IOException;
@@ -42,8 +43,8 @@ import java.util.Objects;
 
 public class ParquetReaderResourceLeakTest extends BaseParquetReaderTest
 {
-  @TempDir
-  public File temporaryFolder;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   @Test
   public void testFetchOnReadCleanupAfterExhaustingIterator() throws IOException
@@ -57,7 +58,7 @@ public class ParquetReaderResourceLeakTest extends BaseParquetReaderTest
     );
     FetchingFileEntity entity = new FetchingFileEntity(new File("example/wiki/wiki.parquet"));
     ParquetInputFormat parquet = new ParquetInputFormat(JSONPathSpec.DEFAULT, false, new Configuration());
-    File tempDir = newFolder(temporaryFolder, "junit");
+    File tempDir = temporaryFolder.newFolder();
     InputEntityReader reader = parquet.createReader(schema, entity, tempDir);
     Assertions.assertEquals(0, Objects.requireNonNull(tempDir.list()).length);
     try (CloseableIterator<InputRow> iterator = reader.read()) {
@@ -115,8 +116,4 @@ public class ParquetReaderResourceLeakTest extends BaseParquetReaderTest
 
   }
 
-  private static File newFolder(File root, String... subDirs)
-  {
-    return FileUtils.createTempDirInLocation(root.toPath(), String.join("-", subDirs));
-  }
 }
diff --git a/extensions-core/parquet-extensions/src/test/java/org/apache/druid/data/input/parquet/ParquetToJsonTest.java b/extensions-core/parquet-extensions/src/test/java/org/apache/druid/data/input/parquet/ParquetToJsonTest.java
index 05d4be4c71d..465c28f2dac 100644
--- a/extensions-core/parquet-extensions/src/test/java/org/apache/druid/data/input/parquet/ParquetToJsonTest.java
+++ b/extensions-core/parquet-extensions/src/test/java/org/apache/druid/data/input/parquet/ParquetToJsonTest.java
@@ -21,11 +21,11 @@ package org.apache.druid.data.input.parquet;
 
 import com.google.common.collect.ImmutableMap;
 import org.apache.druid.jackson.DefaultObjectMapper;
-import org.apache.druid.java.util.common.FileUtils;
 import org.apache.druid.java.util.common.IAE;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.BufferedInputStream;
 import java.io.File;
@@ -39,13 +39,13 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
 @SuppressWarnings("ALL")
 public class ParquetToJsonTest
 {
-  @TempDir
-  public static File tmp;
+  @RegisterExtension
+  public static final TemporaryFolderExtension TMP = TemporaryFolderExtension.classScoped();
 
   @Test
   public void testSanity() throws Exception
   {
-    final File tmpDir = newFolder(tmp, "junit");
+    final File tmpDir = TMP.newFolder();
     try (InputStream in = new BufferedInputStream(ClassLoader.getSystemResourceAsStream("smlTbl.parquet"))) {
       Files.copy(in, tmpDir.toPath().resolve("smlTbl.parquet"));
     }
@@ -76,7 +76,7 @@ public class ParquetToJsonTest
   @Test
   public void testConvertedDates() throws Exception
   {
-    final File tmpDir = newFolder(tmp, "junit");
+    final File tmpDir = TMP.newFolder();
     try (InputStream in = new BufferedInputStream(ClassLoader.getSystemResourceAsStream("smlTbl.parquet"))) {
       Files.copy(in, tmpDir.toPath().resolve("smlTbl.parquet"));
     }
@@ -115,14 +115,14 @@ public class ParquetToJsonTest
   @Test
   public void testEmptyDir() throws Exception
   {
-    final File tmpDir = newFolder(tmp, "junit");
+    final File tmpDir = TMP.newFolder();
     Assertions.assertThrows(IAE.class, () -> ParquetToJson.main(new String[] {tmpDir.getAbsolutePath()}));
   }
 
   @Test
   public void testSomeFile() throws Exception
   {
-    final File file = File.createTempFile("junit", null, tmp);
+    final File file = File.createTempFile("junit", null, TMP.getRoot());
     assertTrue(file.exists());
     Assertions.assertThrows(IAE.class, () -> ParquetToJson.main(new String[] {file.getAbsolutePath()}));
   }
@@ -130,13 +130,9 @@ public class ParquetToJsonTest
   @Test
   public void testNonExistentFile() throws Exception
   {
-    final File file = new File(tmp, "nonExistent");
+    final File file = new File(TMP.getRoot(), "nonExistent");
     assertFalse(file.exists());
     Assertions.assertThrows(IAE.class, () -> ParquetToJson.main(new String[] {file.getAbsolutePath()}));
   }
 
-  private static File newFolder(File root, String... subDirs)
-  {
-    return FileUtils.createTempDirInLocation(root.toPath(), String.join("-", subDirs));
-  }
 }
diff --git a/extensions-core/stats/pom.xml b/extensions-core/stats/pom.xml
index c8ce3fa1afc..7734783642b 100644
--- a/extensions-core/stats/pom.xml
+++ b/extensions-core/stats/pom.xml
@@ -93,12 +93,6 @@
         </dependency>
 
         <!-- Tests -->
-        <!-- Shared test helpers still use JUnit 4 assertions. -->
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
         <dependency>
             <groupId>org.junit.jupiter</groupId>
             <artifactId>junit-jupiter-api</artifactId>
diff --git a/extensions-core/testing-tools/pom.xml b/extensions-core/testing-tools/pom.xml
index 90894207c94..0ce4ce3d243 100644
--- a/extensions-core/testing-tools/pom.xml
+++ b/extensions-core/testing-tools/pom.xml
@@ -177,11 +177,6 @@
       <artifactId>junit-jupiter-engine</artifactId>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>org.junit.jupiter</groupId>
-      <artifactId>junit-jupiter-migrationsupport</artifactId>
-      <scope>test</scope>
-    </dependency>
     <dependency>
       <groupId>org.junit.jupiter</groupId>
       <artifactId>junit-jupiter-params</artifactId>
diff --git a/indexing-service/pom.xml b/indexing-service/pom.xml
index 8dde1965751..da847f2fc58 100644
--- a/indexing-service/pom.xml
+++ b/indexing-service/pom.xml
@@ -182,11 +182,6 @@
             <version>${cronutils.version}</version>
         </dependency>
         <!-- Tests -->
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
         <dependency>
             <groupId>org.junit.jupiter</groupId>
             <artifactId>junit-jupiter-api</artifactId>
@@ -202,16 +197,6 @@
             <artifactId>junit-jupiter-params</artifactId>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>org.junit.jupiter</groupId>
-            <artifactId>junit-jupiter-migrationsupport</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.junit.vintage</groupId>
-            <artifactId>junit-vintage-engine</artifactId>
-            <scope>test</scope>
-        </dependency>
         <dependency>
             <groupId>org.easymock</groupId>
             <artifactId>easymock</artifactId>
@@ -256,11 +241,6 @@
             <artifactId>equalsverifier</artifactId>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>com.github.stefanbirkner</groupId>
-            <artifactId>system-rules</artifactId>
-            <scope>test</scope>
-        </dependency>
         <dependency>
             <groupId>org.mockito</groupId>
             <artifactId>mockito-core</artifactId>
diff --git a/indexing-service/src/test/java/org/apache/druid/guice/IndexingServiceTaskLogsModuleTest.java b/indexing-service/src/test/java/org/apache/druid/guice/IndexingServiceTaskLogsModuleTest.java
index c0d4189e4cc..548f57b68d0 100644
--- a/indexing-service/src/test/java/org/apache/druid/guice/IndexingServiceTaskLogsModuleTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/guice/IndexingServiceTaskLogsModuleTest.java
@@ -29,8 +29,8 @@ import org.apache.druid.jackson.JacksonModule;
 import org.apache.druid.tasklogs.NoopTaskLogs;
 import org.apache.druid.tasklogs.SwitchingTaskLogs;
 import org.apache.druid.tasklogs.TaskLogs;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
 
 import java.util.Properties;
 
@@ -55,14 +55,14 @@ public class IndexingServiceTaskLogsModuleTest
     );
 
     TaskLogs taskLogs = injector.getInstance(TaskLogs.class);
-    Assert.assertTrue(taskLogs instanceof SwitchingTaskLogs);
+    Assertions.assertTrue(taskLogs instanceof SwitchingTaskLogs);
 
     TaskLogs pusher = injector.getInstance(Key.get(TaskLogs.class, Names.named("switching.logPushType")));
-    Assert.assertTrue(pusher instanceof FileTaskLogs);
+    Assertions.assertTrue(pusher instanceof FileTaskLogs);
     TaskLogs reports = injector.getInstance(Key.get(TaskLogs.class, Names.named("switching.reportsType")));
-    Assert.assertTrue(reports instanceof FileTaskLogs);
+    Assertions.assertTrue(reports instanceof FileTaskLogs);
     TaskLogs stream = injector.getInstance(Key.get(TaskLogs.class, Names.named("switching.logStreamType")));
-    Assert.assertTrue(stream instanceof FileTaskLogs);
+    Assertions.assertTrue(stream instanceof FileTaskLogs);
   }
 
   @Test
@@ -86,10 +86,10 @@ public class IndexingServiceTaskLogsModuleTest
     );
 
     TaskLogs pusher = injector.getInstance(Key.get(TaskLogs.class, Names.named("switching.logPushType")));
-    Assert.assertTrue(pusher instanceof FileTaskLogs);
+    Assertions.assertTrue(pusher instanceof FileTaskLogs);
     TaskLogs reports = injector.getInstance(Key.get(TaskLogs.class, Names.named("switching.reportsType")));
-    Assert.assertTrue(reports instanceof NoopTaskLogs);
+    Assertions.assertTrue(reports instanceof NoopTaskLogs);
     TaskLogs stream = injector.getInstance(Key.get(TaskLogs.class, Names.named("switching.logStreamType")));
-    Assert.assertTrue(stream instanceof FileTaskLogs);
+    Assertions.assertTrue(stream instanceof FileTaskLogs);
   }
 }
diff --git a/indexing-service/src/test/java/org/apache/druid/guice/PeonProcessingModuleTest.java b/indexing-service/src/test/java/org/apache/druid/guice/PeonProcessingModuleTest.java
index 13599ee7fab..537e04a8ce8 100644
--- a/indexing-service/src/test/java/org/apache/druid/guice/PeonProcessingModuleTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/guice/PeonProcessingModuleTest.java
@@ -31,8 +31,8 @@ import org.apache.druid.query.ExecutorServiceMonitor;
 import org.apache.druid.query.NoopQueryProcessingPool;
 import org.apache.druid.query.QueryProcessingPool;
 import org.apache.druid.utils.RuntimeInfo;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
 import org.mockito.Mockito;
 
 import java.nio.ByteBuffer;
@@ -48,9 +48,9 @@ public class PeonProcessingModuleTest
         .withProcessingBuffers()
         .withProcessingThreads()
         .withMergeBuffers();
-    Assert.assertTrue(config.hasProcessingBuffers());
-    Assert.assertTrue(config.hasProcessingThreads());
-    Assert.assertTrue(config.hasMergeBuffers());
+    Assertions.assertTrue(config.hasProcessingBuffers());
+    Assertions.assertTrue(config.hasProcessingThreads());
+    Assertions.assertTrue(config.hasMergeBuffers());
   }
 
   @Test
@@ -66,7 +66,7 @@ public class PeonProcessingModuleTest
         new ExecutorServiceMonitor(),
         new Lifecycle()
     );
-    Assert.assertSame(NoopQueryProcessingPool.instance(), pool);
+    Assertions.assertSame(NoopQueryProcessingPool.instance(), pool);
   }
 
   @Test
@@ -83,7 +83,7 @@ public class PeonProcessingModuleTest
         new ExecutorServiceMonitor(),
         new Lifecycle()
     );
-    Assert.assertSame(NoopQueryProcessingPool.instance(), pool);
+    Assertions.assertSame(NoopQueryProcessingPool.instance(), pool);
   }
 
   @Test
@@ -94,7 +94,7 @@ public class PeonProcessingModuleTest
     final RuntimeInfo runtimeInfo = Mockito.mock(RuntimeInfo.class);
 
     final NonBlockingPool<ByteBuffer> pool = module.getIntermediateResultsPool(task, config, runtimeInfo);
-    Assert.assertSame(DummyNonBlockingPool.instance(), pool);
+    Assertions.assertSame(DummyNonBlockingPool.instance(), pool);
   }
 
   @Test
@@ -106,7 +106,7 @@ public class PeonProcessingModuleTest
     final RuntimeInfo runtimeInfo = Mockito.mock(RuntimeInfo.class);
 
     final BlockingPool<ByteBuffer> pool = module.getMergeBufferPool(task, config, runtimeInfo);
-    Assert.assertSame(DummyBlockingPool.instance(), pool);
+    Assertions.assertSame(DummyBlockingPool.instance(), pool);
   }
 
   @Test
@@ -120,6 +120,6 @@ public class PeonProcessingModuleTest
     final RuntimeInfo runtimeInfo = Mockito.mock(RuntimeInfo.class);
 
     final BlockingPool<ByteBuffer> pool = module.getMergeBufferPool(task, config, runtimeInfo);
-    Assert.assertSame(DummyBlockingPool.instance(), pool);
+    Assertions.assertSame(DummyBlockingPool.instance(), pool);
   }
 }
diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/common/MultipleFileTaskReportFileWriterTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/common/MultipleFileTaskReportFileWriterTest.java
index afb3b118cc6..ea823c4dfa6 100644
--- a/indexing-service/src/test/java/org/apache/druid/indexing/common/MultipleFileTaskReportFileWriterTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/indexing/common/MultipleFileTaskReportFileWriterTest.java
@@ -24,9 +24,10 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.druid.indexer.report.IngestionStatsAndErrorsTaskReport;
 import org.apache.druid.indexer.report.TaskReport;
 import org.apache.druid.segment.TestHelper;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.File;
 import java.io.IOException;
@@ -37,14 +38,14 @@ public class MultipleFileTaskReportFileWriterTest
 {
   private static final String TASK_ID = "mytask";
 
-  @TempDir
-  private File temporaryFolder;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   @Test
   public void testReport() throws IOException
   {
     final ObjectMapper mapper = TestHelper.makeJsonMapper();
-    final File file = new File(temporaryFolder, "report.json");
+    final File file = temporaryFolder.newFile("report.json");
     final MultipleFileTaskReportFileWriter writer = new MultipleFileTaskReportFileWriter();
     writer.setObjectMapper(mapper);
     writer.add(TASK_ID, file);
diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/common/SingleFileTaskReportFileWriterTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/common/SingleFileTaskReportFileWriterTest.java
index 54acfdc16ed..61523ced4c2 100644
--- a/indexing-service/src/test/java/org/apache/druid/indexing/common/SingleFileTaskReportFileWriterTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/indexing/common/SingleFileTaskReportFileWriterTest.java
@@ -25,9 +25,10 @@ import org.apache.druid.indexer.report.IngestionStatsAndErrorsTaskReport;
 import org.apache.druid.indexer.report.SingleFileTaskReportFileWriter;
 import org.apache.druid.indexer.report.TaskReport;
 import org.apache.druid.segment.TestHelper;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.File;
 import java.io.IOException;
@@ -38,14 +39,14 @@ public class SingleFileTaskReportFileWriterTest
 {
   private static final String TASK_ID = "mytask";
 
-  @TempDir
-  private File temporaryFolder;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   @Test
   public void testReport() throws IOException
   {
     final ObjectMapper mapper = TestHelper.makeJsonMapper();
-    final File file = new File(temporaryFolder, "report.json");
+    final File file = temporaryFolder.newFile("report.json");
     final SingleFileTaskReportFileWriter writer = new SingleFileTaskReportFileWriter(file);
     writer.setObjectMapper(mapper);
     final TaskReport.ReportMap reportsMap = TaskReport.buildTaskReports(
diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/common/TaskToolboxTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/common/TaskToolboxTest.java
index 147ffae21fd..8770617c607 100644
--- a/indexing-service/src/test/java/org/apache/druid/indexing/common/TaskToolboxTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/indexing/common/TaskToolboxTest.java
@@ -60,16 +60,16 @@ import org.apache.druid.segment.realtime.appenderator.UnifiedIndexerAppenderator
 import org.apache.druid.server.DruidNode;
 import org.apache.druid.server.coordination.DataSegmentAnnouncer;
 import org.apache.druid.server.security.AuthTestUtils;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.apache.druid.utils.JvmUtils;
 import org.apache.druid.utils.RuntimeInfo;
 import org.easymock.EasyMock;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.mockito.Mockito;
 
-import java.io.File;
 import java.io.IOException;
 
 @SuppressWarnings("DoNotMock")
@@ -77,8 +77,8 @@ public class TaskToolboxTest
 {
 
   private TaskToolboxFactory taskToolbox = null;
-  @TempDir
-  private File baseDir;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
   private TaskActionClientFactory mockTaskActionClientFactory = EasyMock.createMock(TaskActionClientFactory.class);
   private ServiceEmitter mockEmitter = EasyMock.createMock(ServiceEmitter.class);
   private DataSegmentPusher mockSegmentPusher = EasyMock.createMock(DataSegmentPusher.class);
@@ -117,7 +117,7 @@ public class TaskToolboxTest
     EasyMock.replay(task, mockHandoffNotifierFactory, mockIndexMergerV9);
 
     TaskConfig taskConfig = new TaskConfigBuilder()
-        .setBaseDir(baseDir.toString())
+        .setBaseDir(temporaryFolder.getRoot().toString())
         .build();
 
     taskToolbox = new TaskToolboxFactory(
diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/AbstractTaskTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/AbstractTaskTest.java
index b1a785edfb9..d7b4260ddd9 100644
--- a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/AbstractTaskTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/AbstractTaskTest.java
@@ -32,16 +32,16 @@ import org.apache.druid.java.util.emitter.service.ServiceMetricEvent;
 import org.apache.druid.query.DruidMetrics;
 import org.apache.druid.server.DruidNode;
 import org.apache.druid.tasklogs.TaskLogPusher;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.mockito.Mockito;
 
 import javax.annotation.Nullable;
 import java.io.File;
 import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
 import java.nio.file.Paths;
 
 import static org.mockito.ArgumentMatchers.any;
@@ -54,8 +54,8 @@ import static org.mockito.Mockito.when;
 
 public class AbstractTaskTest
 {
-  @TempDir
-  private File temporaryFolder;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   private ObjectMapper objectMapper;
 
@@ -67,14 +67,14 @@ public class AbstractTaskTest
 
   private File createTempReportFile() throws Exception
   {
-    final File reportsFile = Files.createTempFile(temporaryFolder.toPath(), "report", ".json").toFile();
+    final File reportsFile = temporaryFolder.newFile("report.json");
     FileUtils.write(reportsFile, "", StandardCharsets.UTF_8);
     return reportsFile;
   }
 
-  private File createTempDir()
+  private File createTempDir() throws Exception
   {
-    return org.apache.druid.java.util.common.FileUtils.createTempDirInLocation(temporaryFolder.toPath(), "task");
+    return temporaryFolder.newFolder("task");
   }
 
   @Test
diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/CompactionTaskParallelRunTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/CompactionTaskParallelRunTest.java
index f76cfecd756..82aa8dafab7 100644
--- a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/CompactionTaskParallelRunTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/CompactionTaskParallelRunTest.java
@@ -152,7 +152,7 @@ public class CompactionTaskParallelRunTest extends AbstractParallelIndexSupervis
     getObjectMapper().registerSubtypes(ParallelIndexTuningConfig.class, DruidInputSource.class);
     getObjectMapper().registerSubtypes(CompactionTask.CompactionTuningConfig.class, DruidInputSource.class);
 
-    inputDir = FileUtils.createTempDirInLocation(temporaryFolder.toPath(), "input");
+    inputDir = FileUtils.createTempDirInLocation(temporaryFolder.getRoot().toPath(), "input");
     final File tmpFile = File.createTempFile("druid", "index", inputDir);
 
     try (BufferedWriter writer = Files.newWriter(tmpFile, StandardCharsets.UTF_8)) {
diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/CompactionTaskRunBase.java b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/CompactionTaskRunBase.java
index 63e3913ede2..6dd77ff2ffe 100644
--- a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/CompactionTaskRunBase.java
+++ b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/CompactionTaskRunBase.java
@@ -59,7 +59,6 @@ import org.apache.druid.indexing.common.actions.TaskActionTestKit;
 import org.apache.druid.indexing.common.config.TaskConfigBuilder;
 import org.apache.druid.indexing.common.task.CompactionTask.Builder;
 import org.apache.druid.indexing.overlord.Segments;
-import org.apache.druid.java.util.common.FileUtils;
 import org.apache.druid.java.util.common.ISE;
 import org.apache.druid.java.util.common.Intervals;
 import org.apache.druid.java.util.common.Pair;
@@ -113,6 +112,7 @@ import org.apache.druid.segment.realtime.WindowedCursorFactory;
 import org.apache.druid.segment.transform.CompactionTransformSpec;
 import org.apache.druid.server.metrics.NoopServiceEmitter;
 import org.apache.druid.server.security.AuthTestUtils;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.apache.druid.timeline.CompactionState;
 import org.apache.druid.timeline.DataSegment;
 import org.apache.druid.timeline.partition.HashBasedNumberedShardSpec;
@@ -126,7 +126,6 @@ import org.junit.jupiter.api.Assumptions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.RegisterExtension;
-import org.junit.jupiter.api.io.TempDir;
 
 import javax.annotation.Nullable;
 
@@ -189,8 +188,10 @@ public abstract class CompactionTaskRunBase
   );
   protected static final int TOTAL_TEST_ROWS = 10;
 
-  @TempDir
-  protected static File temporaryFolder;
+  //CHECKSTYLE.OFF: ConstantName
+  @RegisterExtension
+  public static final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.classScoped();
+  //CHECKSTYLE.ON: ConstantName
 
   @RegisterExtension
   public TaskActionTestKit taskActionTestKit = new TaskActionTestKit();
@@ -232,7 +233,7 @@ public abstract class CompactionTaskRunBase
     this.inputInterval = inputInterval;
     this.segmentGranularity = segmentGranularity;
 
-    reportsFile = new File(temporaryFolder, "reports.json");
+    reportsFile = new File(temporaryFolder.getRoot(), "reports.json");
     testUtils = new TestUtils();
     segmentCacheManagerFactory = SegmentCacheManagerFactory.createWithOwnedPool(TestIndex.INDEX_IO, testUtils.getTestObjectMapper());
 
@@ -283,7 +284,7 @@ public abstract class CompactionTaskRunBase
   public void setup() throws IOException
   {
     exec = Execs.multiThreaded(2, "compaction-task-run-test-%d");
-    localDeepStorage = newTempFolder();
+    localDeepStorage = temporaryFolder.newFolder();
   }
 
   @AfterEach
@@ -292,11 +293,6 @@ public abstract class CompactionTaskRunBase
     exec.shutdownNow();
   }
 
-  protected File newTempFolder()
-  {
-    return FileUtils.createTempDirInLocation(temporaryFolder.toPath(), "tmp");
-  }
-
   @Test
   public void testRunWithDynamicPartitioning() throws Exception
   {
@@ -1233,7 +1229,7 @@ public abstract class CompactionTaskRunBase
     Assertions.assertEquals(newCompactionState, segments.get(0).getLastCompactionState());
     Assertions.assertEquals(new NumberedShardSpec(0, 1), segments.get(0).getShardSpec());
 
-    final File cacheDir = newTempFolder();
+    final File cacheDir = temporaryFolder.newFolder();
     final SegmentCacheManager segmentCacheManager = segmentCacheManagerFactory.manufacturate(
         cacheDir,
         null,
@@ -1347,7 +1343,7 @@ public abstract class CompactionTaskRunBase
     Assertions.assertEquals(expectedState, segments.get(0).getLastCompactionState());
     Assertions.assertEquals(new NumberedShardSpec(0, 1), segments.get(0).getShardSpec());
 
-    final File cacheDir = newTempFolder();
+    final File cacheDir = temporaryFolder.newFolder();
     final SegmentCacheManager segmentCacheManager = segmentCacheManagerFactory.manufacturate(
         cacheDir,
         null,
@@ -1466,7 +1462,7 @@ public abstract class CompactionTaskRunBase
     Assertions.assertEquals(expectedState, compactSegment.getLastCompactionState());
     Assertions.assertEquals(new NumberedShardSpec(0, 1), compactSegment.getShardSpec());
 
-    final File cacheDir = newTempFolder();
+    final File cacheDir = temporaryFolder.newFolder();
     final SegmentCacheManager segmentCacheManager = segmentCacheManagerFactory.manufacturate(
         cacheDir,
         null,
@@ -1584,7 +1580,7 @@ public abstract class CompactionTaskRunBase
       boolean appendToExisting
   ) throws Exception
   {
-    File tmpDir = newTempFolder();
+    File tmpDir = temporaryFolder.newFolder();
     File tmpFile = File.createTempFile("druid", "index", tmpDir);
 
     try (BufferedWriter writer = Files.newWriter(tmpFile, StandardCharsets.UTF_8)) {
@@ -1668,7 +1664,7 @@ public abstract class CompactionTaskRunBase
 
   protected abstract Builder compactionTaskBuilder(ClientCompactionTaskGranularitySpec granularitySpec);
 
-  private TaskToolbox createTaskToolbox(ObjectMapper objectMapper, TaskActionClient taskActionClient)
+  private TaskToolbox createTaskToolbox(ObjectMapper objectMapper, TaskActionClient taskActionClient) throws IOException
   {
     final SegmentLoaderConfig loaderConfig = SegmentLoaderConfig.builder()
         .locations(new StorageLocationConfig(localDeepStorage, null, null))
@@ -1694,7 +1690,7 @@ public abstract class CompactionTaskRunBase
         .joinableFactory(NoopJoinableFactory.INSTANCE)
         .segmentCacheManager(cacheManager)
         .jsonMapper(objectMapper)
-        .taskWorkDir(newTempFolder())
+        .taskWorkDir(temporaryFolder.newFolder())
         .indexIO(testUtils.getTestIndexIO())
         .handoffNotifierFactory(new NoopSegmentHandoffNotifierFactory())
         .indexMerger(testUtils.getIndexMergerV9Factory().create(true))
@@ -1713,7 +1709,7 @@ public abstract class CompactionTaskRunBase
 
   protected List<String> getCSVFormatRowsFromSegments(List<DataSegment> segments) throws Exception
   {
-    final File cacheDir = newTempFolder();
+    final File cacheDir = temporaryFolder.newFolder();
     final SegmentCacheManager segmentCacheManager = segmentCacheManagerFactory.manufacturate(
         cacheDir,
         null,
diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/FilteringCloseableInputRowIteratorTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/FilteringCloseableInputRowIteratorTest.java
index e28ec5a154c..b6efcd0764a 100644
--- a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/FilteringCloseableInputRowIteratorTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/FilteringCloseableInputRowIteratorTest.java
@@ -33,9 +33,9 @@ import org.apache.druid.segment.incremental.ParseExceptionHandler;
 import org.apache.druid.segment.incremental.RowIngestionMeters;
 import org.apache.druid.segment.incremental.SimpleRowIngestionMeters;
 import org.joda.time.DateTime;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 import org.mockito.ArgumentCaptor;
 import org.mockito.Mockito;
 
@@ -62,7 +62,7 @@ public class FilteringCloseableInputRowIteratorTest
   private RowIngestionMeters rowIngestionMeters;
   private ParseExceptionHandler parseExceptionHandler;
 
-  @Before
+  @BeforeEach
   public void setup()
   {
     rowIngestionMeters = new SimpleRowIngestionMeters();
@@ -86,11 +86,11 @@ public class FilteringCloseableInputRowIteratorTest
     );
     final List<InputRow> filteredRows = new ArrayList<>();
     rowIterator.forEachRemaining(filteredRows::add);
-    Assert.assertEquals(
+    Assertions.assertEquals(
         ROWS.stream().filter(filter).collect(Collectors.toList()),
         filteredRows
     );
-    Assert.assertEquals(2, rowIngestionMeters.getThrownAway());
+    Assertions.assertEquals(2, rowIngestionMeters.getThrownAway());
   }
 
   @Test
@@ -134,8 +134,8 @@ public class FilteringCloseableInputRowIteratorTest
 
     final List<InputRow> filteredRows = new ArrayList<>();
     rowIterator.forEachRemaining(filteredRows::add);
-    Assert.assertEquals(ROWS, filteredRows);
-    Assert.assertEquals(ROWS.size(), rowIngestionMeters.getUnparseable());
+    Assertions.assertEquals(ROWS, filteredRows);
+    Assertions.assertEquals(ROWS.size(), rowIngestionMeters.getUnparseable());
   }
 
   @Test
@@ -177,8 +177,8 @@ public class FilteringCloseableInputRowIteratorTest
         ROWS.get(2),
         ROWS.get(4)
     );
-    Assert.assertEquals(expectedRows, filteredRows);
-    Assert.assertEquals(ROWS.size() - expectedRows.size(), rowIngestionMeters.getUnparseable());
+    Assertions.assertEquals(expectedRows, filteredRows);
+    Assertions.assertEquals(ROWS.size() - expectedRows.size(), rowIngestionMeters.getUnparseable());
   }
 
   @Test
@@ -223,11 +223,11 @@ public class FilteringCloseableInputRowIteratorTest
 
     final List<InputRow> filteredRows = new ArrayList<>();
     rowIterator.forEachRemaining(filteredRows::add);
-    Assert.assertEquals(ROWS, filteredRows);
-    Assert.assertEquals(ROWS.size(), rowIngestionMeters.getUnparseable());
+    Assertions.assertEquals(ROWS, filteredRows);
+    Assertions.assertEquals(ROWS.size(), rowIngestionMeters.getUnparseable());
   }
 
-  @Test(expected = RuntimeException.class)
+  @Test
   public void testNonParseExceptionInDelegateHasNext()
   {
     // This iterator throws ParseException every other call to hasNext().
@@ -267,10 +267,15 @@ public class FilteringCloseableInputRowIteratorTest
         parseExceptionHandler
     );
 
-    while (rowIterator.hasNext()) {
-      rowIterator.next();
-    }
-    Assert.fail("you never should have come here");
+    Assertions.assertThrows(
+        RuntimeException.class,
+        () -> {
+          while (rowIterator.hasNext()) {
+            rowIterator.next();
+          }
+          Assertions.fail("you never should have come here");
+        }
+    );
   }
 
   @Test
@@ -288,7 +293,7 @@ public class FilteringCloseableInputRowIteratorTest
         parseExceptionHandler
     );
     rowIterator.close();
-    Assert.assertTrue(closed.isTrue());
+    Assertions.assertTrue(closed.isTrue());
   }
 
   @Test
@@ -342,13 +347,13 @@ public class FilteringCloseableInputRowIteratorTest
     ArgumentCaptor<Exception> exceptionArgumentCaptor = ArgumentCaptor.forClass(Exception.class);
     Mockito.verify(parseExceptionHandler, Mockito.times(6)).logParseExceptionHelper(exceptionArgumentCaptor.capture());
     Exception parseException = exceptionArgumentCaptor.getValue();
-    Assert.assertTrue(parseException.getMessage().contains("Parse exception at"));
-    Assert.assertNotNull(parseException.getCause());
-    Assert.assertTrue(parseException.getCause().getMessage().contains("this is the root cause of the exception!"));
-    Assert.assertEquals(IllegalArgumentException.class, parseException.getCause().getClass());
+    Assertions.assertTrue(parseException.getMessage().contains("Parse exception at"));
+    Assertions.assertNotNull(parseException.getCause());
+    Assertions.assertTrue(parseException.getCause().getMessage().contains("this is the root cause of the exception!"));
+    Assertions.assertEquals(IllegalArgumentException.class, parseException.getCause().getClass());
 
-    Assert.assertEquals(ROWS, filteredRows);
-    Assert.assertEquals(ROWS.size(), rowIngestionMeters.getUnparseable());
+    Assertions.assertEquals(ROWS, filteredRows);
+    Assertions.assertEquals(ROWS.size(), rowIngestionMeters.getUnparseable());
   }
 
 
@@ -378,19 +383,19 @@ public class FilteringCloseableInputRowIteratorTest
     rowIterator.forEachRemaining(filteredRows::add);
 
     // Only rows with dim1=10 should pass
-    Assert.assertEquals(4, filteredRows.size());
+    Assertions.assertEquals(4, filteredRows.size());
     for (InputRow row : filteredRows) {
-      Assert.assertEquals(10, row.getRaw("dim1"));
+      Assertions.assertEquals(10, row.getRaw("dim1"));
     }
 
     // Check total thrown away
-    Assert.assertEquals(2, rowIngestionMeters.getThrownAway());
+    Assertions.assertEquals(2, rowIngestionMeters.getThrownAway());
 
     // Check per-reason counts
     Map<String, Long> byReason = rowIngestionMeters.getThrownAwayByReason();
-    Assert.assertEquals(2, byReason.size());
-    Assert.assertEquals(Long.valueOf(1), byReason.get(InputRowFilterResult.BEFORE_MIN_MESSAGE_TIME.getReason())); // dim1=20
-    Assert.assertEquals(Long.valueOf(1), byReason.get(InputRowFilterResult.CUSTOM_FILTER.getReason())); // dim1=30
+    Assertions.assertEquals(2, byReason.size());
+    Assertions.assertEquals(Long.valueOf(1), byReason.get(InputRowFilterResult.BEFORE_MIN_MESSAGE_TIME.getReason())); // dim1=20
+    Assertions.assertEquals(Long.valueOf(1), byReason.get(InputRowFilterResult.CUSTOM_FILTER.getReason())); // dim1=30
   }
 
   @Test
@@ -410,13 +415,13 @@ public class FilteringCloseableInputRowIteratorTest
     final List<InputRow> filteredRows = new ArrayList<>();
     rowIterator.forEachRemaining(filteredRows::add);
 
-    Assert.assertEquals(4, filteredRows.size());
-    Assert.assertEquals(2, rowIngestionMeters.getThrownAway());
+    Assertions.assertEquals(4, filteredRows.size());
+    Assertions.assertEquals(2, rowIngestionMeters.getThrownAway());
 
     // All thrown away should have FILTERED reason when using fromPredicate
     Map<String, Long> byReason = rowIngestionMeters.getThrownAwayByReason();
-    Assert.assertEquals(1, byReason.size());
-    Assert.assertEquals(Long.valueOf(2), byReason.get(InputRowFilterResult.CUSTOM_FILTER.getReason()));
+    Assertions.assertEquals(1, byReason.size());
+    Assertions.assertEquals(Long.valueOf(2), byReason.get(InputRowFilterResult.CUSTOM_FILTER.getReason()));
   }
 
   @Test
@@ -441,12 +446,12 @@ public class FilteringCloseableInputRowIteratorTest
     final List<InputRow> filteredRows = new ArrayList<>();
     rowIterator.forEachRemaining(filteredRows::add);
 
-    Assert.assertEquals(4, filteredRows.size());
-    Assert.assertEquals(2, rowIngestionMeters.getThrownAway());
+    Assertions.assertEquals(4, filteredRows.size());
+    Assertions.assertEquals(2, rowIngestionMeters.getThrownAway());
 
     // All rejected rows should have FILTERED reason (from second filter)
     Map<String, Long> byReason = rowIngestionMeters.getThrownAwayByReason();
-    Assert.assertEquals(Long.valueOf(2), byReason.get(InputRowFilterResult.CUSTOM_FILTER.getReason()));
+    Assertions.assertEquals(Long.valueOf(2), byReason.get(InputRowFilterResult.CUSTOM_FILTER.getReason()));
   }
 
   private static InputRow newRow(DateTime timestamp, Object dim1Val, Object dim2Val)
diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/IndexTaskTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/IndexTaskTest.java
index 5c55b789677..4c056049fd7 100644
--- a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/IndexTaskTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/IndexTaskTest.java
@@ -198,8 +198,8 @@ public class IndexTaskTest extends IngestionTestBase
   @BeforeEach
   public void setup() throws IOException
   {
-    final File cacheDir = FileUtils.createTempDirInLocation(temporaryFolder.toPath(), "cache");
-    tmpDir = FileUtils.createTempDirInLocation(temporaryFolder.toPath(), "input");
+    final File cacheDir = FileUtils.createTempDirInLocation(temporaryFolder.getRoot().toPath(), "cache");
+    tmpDir = FileUtils.createTempDirInLocation(temporaryFolder.getRoot().toPath(), "input");
     final SegmentLoaderConfig loaderConfig = SegmentLoaderConfig.builder()
         .locations(new StorageLocationConfig(cacheDir, null, null))
         .build();
@@ -2177,7 +2177,7 @@ public class IndexTaskTest extends IngestionTestBase
 
     // create new data but with an ingestion interval appropriate to filter it all out so that only tombstones
     // are created:
-    tmpDir = FileUtils.createTempDirInLocation(temporaryFolder.toPath(), "input");
+    tmpDir = FileUtils.createTempDirInLocation(temporaryFolder.getRoot().toPath(), "input");
     try (BufferedWriter writer = Files.newWriter(createTempFile(), StandardCharsets.UTF_8)) {
       writer.write("2014-01-01T00:00:10Z,a,1\n");
       writer.write("2014-01-01T01:00:20Z,b,1\n");
diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/IngestionTestBase.java b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/IngestionTestBase.java
index 0c66a619faa..17a40ed01d8 100644
--- a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/IngestionTestBase.java
+++ b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/IngestionTestBase.java
@@ -51,7 +51,6 @@ import org.apache.druid.indexing.overlord.TaskStorage;
 import org.apache.druid.indexing.overlord.autoscaling.ScalingStats;
 import org.apache.druid.indexing.overlord.supervisor.SupervisorManager;
 import org.apache.druid.indexing.test.TestDataSegmentKiller;
-import org.apache.druid.java.util.common.FileUtils;
 import org.apache.druid.java.util.common.ISE;
 import org.apache.druid.java.util.common.Pair;
 import org.apache.druid.java.util.common.StringUtils;
@@ -87,15 +86,14 @@ import org.apache.druid.server.coordinator.simulate.TestDruidLeaderSelector;
 import org.apache.druid.server.metrics.NoopServiceEmitter;
 import org.apache.druid.server.security.AuthTestUtils;
 import org.apache.druid.testing.InitializedNullHandlingTest;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.apache.druid.timeline.DataSegment;
 import org.apache.druid.utils.JvmUtils;
 import org.joda.time.Period;
-import org.junit.After;
-import org.junit.Before;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.File;
 import java.io.IOException;
@@ -111,11 +109,8 @@ import java.util.stream.Collectors;
 
 public abstract class IngestionTestBase extends InitializedNullHandlingTest
 {
-  @org.junit.Rule
-  public final org.junit.rules.TemporaryFolder junit4TemporaryFolder = new org.junit.rules.TemporaryFolder();
-
-  @TempDir
-  public File temporaryFolder;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   public final TestDerbyConnector.DerbyConnectorRule derbyConnectorRule =
       new TestDerbyConnector.DerbyConnectorRule(CentralizedDatasourceSchemaConfig.enabled(true));
@@ -148,16 +143,12 @@ public abstract class IngestionTestBase extends InitializedNullHandlingTest
   }
 
 
-  @Before
   @BeforeEach
   public void setUpIngestionTestBase() throws IOException
   {
-    if (temporaryFolder == null) {
-      temporaryFolder = junit4TemporaryFolder.getRoot();
-    }
     derbyConnectorRule.before();
     EmittingLogger.registerEmitter(new NoopServiceEmitter());
-    baseDir = FileUtils.createTempDirInLocation(temporaryFolder.toPath(), "base");
+    baseDir = temporaryFolder.newFolder("base");
 
     final SQLMetadataConnector connector = derbyConnectorRule.getConnector();
     connector.createTaskTables();
@@ -196,7 +187,7 @@ public abstract class IngestionTestBase extends InitializedNullHandlingTest
     lockbox = new GlobalTaskLockbox(taskStorage, storageCoordinator);
     lockbox.syncFromStorage();
     segmentCacheManagerFactory = SegmentCacheManagerFactory.createWithOwnedPool(TestIndex.INDEX_IO, getObjectMapper());
-    reportsFile = new File(temporaryFolder, "reports.json");
+    reportsFile = temporaryFolder.newFile("reports.json");
     dataSegmentKiller = new TestDataSegmentKiller();
     taskActionToolbox = createTaskActionToolbox();
 
@@ -204,7 +195,6 @@ public abstract class IngestionTestBase extends InitializedNullHandlingTest
     segmentMetadataCache.becomeLeader();
   }
 
-  @After
   @AfterEach
   public void tearDownIngestionTestBase()
   {
@@ -481,7 +471,7 @@ public abstract class IngestionTestBase extends InitializedNullHandlingTest
         taskStorage.insert(task, TaskStatus.running(task.getId()));
         taskActionClient = createActionClient(task);
         taskReportsFile = new File(
-            temporaryFolder,
+            temporaryFolder.getRoot(),
             StringUtils.format("ingestionTestBase-%s.json", System.currentTimeMillis())
         );
 
diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/AbstractParallelIndexSupervisorTaskTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/AbstractParallelIndexSupervisorTaskTest.java
index 196330ad75b..1ca23a349da 100644
--- a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/AbstractParallelIndexSupervisorTaskTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/AbstractParallelIndexSupervisorTaskTest.java
@@ -113,7 +113,6 @@ import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.TestInfo;
-import org.junit.jupiter.api.io.TempDir;
 
 import javax.annotation.Nullable;
 import java.io.File;
@@ -166,19 +165,6 @@ public class AbstractParallelIndexSupervisorTaskTest extends IngestionTestBase
 
   private static final Logger LOG = new Logger(AbstractParallelIndexSupervisorTaskTest.class);
 
-  @TempDir
-  protected File parallelTemporaryFolder;
-
-  protected final File createTempDir()
-  {
-    return FileUtils.createTempDirInLocation(parallelTemporaryFolder.toPath(), null);
-  }
-
-  protected final File createTempDir(final String prefix)
-  {
-    return FileUtils.createTempDirInLocation(parallelTemporaryFolder.toPath(), prefix);
-  }
-
   /**
    * Transient task failure rate emulated by the taskKiller in {@link SimpleThreadingTaskRunner}.
    * Per {@link SubTaskSpec}, there could be at most one task failure.
@@ -226,7 +212,7 @@ public class AbstractParallelIndexSupervisorTaskTest extends IngestionTestBase
   @BeforeEach
   public void setUpAbstractParallelIndexSupervisorTaskTest(TestInfo testInfo) throws IOException
   {
-    localDeepStorage = FileUtils.createTempDirInLocation(parallelTemporaryFolder.toPath(), "localStorage");
+    localDeepStorage = temporaryFolder.newFolder("localStorage");
     taskRunner = new SimpleThreadingTaskRunner(testInfo.getTestMethod().orElseThrow().getName());
     objectMapper = getObjectMapper();
     indexingServiceClient = new LocalOverlordClient(objectMapper, taskRunner);
@@ -234,7 +220,7 @@ public class AbstractParallelIndexSupervisorTaskTest extends IngestionTestBase
         .setShuffleDataLocations(
             ImmutableList.of(
                 new StorageLocationConfig(
-                    FileUtils.createTempDirInLocation(parallelTemporaryFolder.toPath(), "shuffle"),
+                    temporaryFolder.newFolder("shuffle"),
                     null,
                     null
                 )
@@ -689,10 +675,10 @@ public class AbstractParallelIndexSupervisorTaskTest extends IngestionTestBase
         .dataSegmentKiller(new NoopDataSegmentKiller())
         .joinableFactory(NoopJoinableFactory.INSTANCE)
         .segmentCacheManager(
-            newSegmentLoader(FileUtils.createTempDirInLocation(parallelTemporaryFolder.toPath(), "segmentCache"))
+            newSegmentLoader(temporaryFolder.newFolder("segmentCache"))
         )
         .jsonMapper(objectMapper)
-        .taskWorkDir(FileUtils.createTempDirInLocation(parallelTemporaryFolder.toPath(), task.getId()))
+        .taskWorkDir(temporaryFolder.newFolder(task.getId()))
         .indexIO(getIndexIO())
         .indexMerger(getIndexMergerV9Factory().create(task.getContextValue(Tasks.STORE_EMPTY_COLUMNS_KEY, true)))
         .intermediaryDataManager(intermediaryDataManager)
diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/DeepStorageShuffleClientTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/DeepStorageShuffleClientTest.java
index 48dbac3f2f9..93183913746 100644
--- a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/DeepStorageShuffleClientTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/DeepStorageShuffleClientTest.java
@@ -29,16 +29,16 @@ import org.apache.druid.guice.GuiceAnnotationIntrospector;
 import org.apache.druid.guice.GuiceInjectableValues;
 import org.apache.druid.guice.GuiceInjectors;
 import org.apache.druid.jackson.DefaultObjectMapper;
-import org.apache.druid.java.util.common.FileUtils;
 import org.apache.druid.java.util.common.Intervals;
 import org.apache.druid.java.util.common.StringUtils;
 import org.apache.druid.segment.loading.LocalDataSegmentPuller;
 import org.apache.druid.segment.loading.LocalLoadSpec;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.apache.druid.utils.CompressionUtils;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.File;
 import java.io.IOException;
@@ -53,8 +53,8 @@ public class DeepStorageShuffleClientTest
   private File segmentFile;
   private String segmentFileName;
 
-  @TempDir
-  private File temporaryFolder;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
 
   @BeforeEach
@@ -76,7 +76,7 @@ public class DeepStorageShuffleClientTest
     );
     deepStorageShuffleClient = new DeepStorageShuffleClient(mapper);
 
-    final File temp = File.createTempFile("junit", null, temporaryFolder);
+    final File temp = temporaryFolder.newFile();
     segmentFileName = temp.getName();
     try (Writer writer = Files.newBufferedWriter(temp.toPath(), StandardCharsets.UTF_8)) {
       for (int j = 0; j < 10; j++) {
@@ -90,7 +90,7 @@ public class DeepStorageShuffleClientTest
   @Test
   public void fetchSegmentFile() throws IOException
   {
-    final File partitionDir = FileUtils.createTempDirInLocation(temporaryFolder.toPath(), null);
+    final File partitionDir = temporaryFolder.newFolder();
     final String subTaskId = "subTask";
     final File unzippedDir = deepStorageShuffleClient.fetchSegmentFile(
         partitionDir,
diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/DimensionCardinalityReportTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/DimensionCardinalityReportTest.java
index 16e3a0ef30e..efa28a9acdd 100644
--- a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/DimensionCardinalityReportTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/DimensionCardinalityReportTest.java
@@ -28,14 +28,14 @@ import org.apache.druid.hll.HyperLogLogCollector;
 import org.apache.druid.indexing.common.task.IndexTask;
 import org.apache.druid.java.util.common.Intervals;
 import org.apache.druid.segment.TestHelper;
-import org.apache.druid.testing.junit.LoggerCaptureRule;
+import org.apache.druid.testing.junit.LoggerCaptureExtension;
 import org.apache.logging.log4j.Level;
 import org.apache.logging.log4j.core.LogEvent;
 import org.joda.time.Interval;
-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 org.junit.jupiter.api.extension.RegisterExtension;
 import org.mockito.Mockito;
 
 import java.util.ArrayList;
@@ -51,13 +51,13 @@ public class DimensionCardinalityReportTest
 
   private DimensionCardinalityReport target;
 
-  private final LoggerCaptureRule logger = new LoggerCaptureRule(ParallelIndexSupervisorTask.class);
+  @RegisterExtension
+  private final LoggerCaptureExtension logger = new LoggerCaptureExtension(ParallelIndexSupervisorTask.class);
 
 
   @BeforeEach
   public void setup()
   {
-    logger.before();
     Interval interval = Intervals.ETERNITY;
     HyperLogLogCollector collector = HyperLogLogCollector.makeLatestCollector();
     Map<Interval, byte[]> intervalToCardinality = Collections.singletonMap(interval, collector.toByteArray());
@@ -65,12 +65,6 @@ public class DimensionCardinalityReportTest
     target = new DimensionCardinalityReport(taskId, intervalToCardinality);
   }
 
-  @AfterEach
-  public void tearDown()
-  {
-    logger.after();
-  }
-
   @Test
   public void serializesDeserializes()
   {
diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/HashPartitionAdjustingCorePartitionSizeTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/HashPartitionAdjustingCorePartitionSizeTest.java
index bf45f1e25bf..2228410d8c8 100644
--- a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/HashPartitionAdjustingCorePartitionSizeTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/HashPartitionAdjustingCorePartitionSizeTest.java
@@ -87,7 +87,7 @@ public class HashPartitionAdjustingCorePartitionSizeTest extends AbstractMultiPh
   @Test
   public void testLessPartitionsThanBuckets() throws IOException
   {
-    final File inputDir = createTempDir();
+    final File inputDir = temporaryFolder.newFolder();
     for (int i = 0; i < 3; i++) {
       try (final Writer writer =
                Files.newBufferedWriter(new File(inputDir, "test_" + i).toPath(), StandardCharsets.UTF_8)) {
@@ -129,7 +129,7 @@ public class HashPartitionAdjustingCorePartitionSizeTest extends AbstractMultiPh
   @Test
   public void testEqualNumberOfPartitionsToBuckets() throws IOException
   {
-    final File inputDir = createTempDir();
+    final File inputDir = temporaryFolder.newFolder();
     for (int i = 0; i < 10; i++) {
       try (final Writer writer =
                Files.newBufferedWriter(new File(inputDir, "test_" + i).toPath(), StandardCharsets.UTF_8)) {
diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/HashPartitionMultiPhaseParallelIndexingTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/HashPartitionMultiPhaseParallelIndexingTest.java
index a118b262146..f45a950175e 100644
--- a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/HashPartitionMultiPhaseParallelIndexingTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/HashPartitionMultiPhaseParallelIndexingTest.java
@@ -121,7 +121,7 @@ public class HashPartitionMultiPhaseParallelIndexingTest extends AbstractMultiPh
   @BeforeEach
   public void setup() throws IOException
   {
-    inputDir = createTempDir("data");
+    inputDir = temporaryFolder.newFolder("data");
     final Set<Interval> intervals = new HashSet<>();
     // set up data
     for (int i = 0; i < 10; i++) {
@@ -339,14 +339,14 @@ public class HashPartitionMultiPhaseParallelIndexingTest extends AbstractMultiPh
   private void assertHashedPartition(
       Set<DataSegment> publishedSegments,
       Map<Interval, Integer> expectedIntervalToNumSegments
-  )
+  ) throws IOException
   {
     final Map<Interval, List<DataSegment>> intervalToSegments = new HashMap<>();
     publishedSegments.forEach(
         segment -> intervalToSegments.computeIfAbsent(segment.getInterval(), k -> new ArrayList<>()).add(segment)
     );
     Assertions.assertEquals(new HashSet<>(inputIntervals), intervalToSegments.keySet());
-    final File tempSegmentDir = createTempDir();
+    final File tempSegmentDir = temporaryFolder.newFolder();
     for (Entry<Interval, List<DataSegment>> entry : intervalToSegments.entrySet()) {
       Interval interval = entry.getKey();
       List<DataSegment> segmentsInInterval = entry.getValue();
@@ -390,7 +390,7 @@ public class HashPartitionMultiPhaseParallelIndexingTest extends AbstractMultiPh
 
   private File newInputDirForReplace() throws IOException
   {
-    File inputDirectory = createTempDir("dataReplace");
+    File inputDirectory = temporaryFolder.newFolder("dataReplace");
     // set up data
     Set<Integer> fileIds = new HashSet<>();
     fileIds.add(3);
diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/HashPartitionTaskKillTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/HashPartitionTaskKillTest.java
index 15275057d4d..ac4f2362fb8 100644
--- a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/HashPartitionTaskKillTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/HashPartitionTaskKillTest.java
@@ -94,7 +94,7 @@ public class HashPartitionTaskKillTest extends AbstractMultiPhaseParallelIndexin
   @BeforeEach
   public void setup() throws IOException
   {
-    inputDir = createTempDir("data");
+    inputDir = temporaryFolder.newFolder("data");
     final Set<Interval> intervals = new HashSet<>();
     // set up data
     for (int i = 0; i < 10; i++) {
diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/HttpShuffleClientTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/HttpShuffleClientTest.java
index b136f3efced..e11a3137d17 100644
--- a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/HttpShuffleClientTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/HttpShuffleClientTest.java
@@ -21,19 +21,19 @@ package org.apache.druid.indexing.common.task.batch.parallel;
 
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
-import org.apache.druid.java.util.common.FileUtils;
 import org.apache.druid.java.util.common.Intervals;
 import org.apache.druid.java.util.common.StringUtils;
 import org.apache.druid.java.util.common.concurrent.Execs;
 import org.apache.druid.java.util.http.client.HttpClient;
 import org.apache.druid.java.util.http.client.response.InputStreamResponseHandler;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.apache.druid.utils.CompressionUtils;
 import org.easymock.EasyMock;
 import org.joda.time.Interval;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.File;
 import java.io.FileInputStream;
@@ -58,15 +58,15 @@ public class HttpShuffleClientTest
   private static final int PORT = 1080;
   private static final int PARTITION_ID = 0;
 
-  @TempDir
-  private File temporaryFolder;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   private File segmentFile;
 
   @BeforeEach
   public void setup() throws IOException
   {
-    final File temp = File.createTempFile("junit", null, temporaryFolder);
+    final File temp = temporaryFolder.newFile();
     try (Writer writer = Files.newBufferedWriter(temp.toPath(), StandardCharsets.UTF_8)) {
       for (int j = 0; j < 10; j++) {
         writer.write(StringUtils.format("let's write some data.\n"));
@@ -80,7 +80,7 @@ public class HttpShuffleClientTest
   public void testFetchSegmentFileWithValidParamsReturningCopiedFileInPartitoinDir() throws IOException
   {
     ShuffleClient shuffleClient = mockClient(0);
-    final File localDir = FileUtils.createTempDirInLocation(temporaryFolder.toPath(), null);
+    final File localDir = temporaryFolder.newFolder();
     final File fetchedFile = shuffleClient.fetchSegmentFile(
         localDir,
         SUPERVISOR_TASK_ID,
@@ -96,7 +96,7 @@ public class HttpShuffleClientTest
     Assertions.assertThrows(
         IOException.class,
         () -> shuffleClient.fetchSegmentFile(
-            FileUtils.createTempDirInLocation(temporaryFolder.toPath(), null),
+            temporaryFolder.newFolder(),
             SUPERVISOR_TASK_ID,
             new TestPartitionLocation()
         )
@@ -107,7 +107,7 @@ public class HttpShuffleClientTest
   public void testFetchSegmentFileWithTransientFailuresReturningCopiedFileInPartitionDir() throws IOException
   {
     ShuffleClient shuffleClient = mockClient(HttpShuffleClient.NUM_FETCH_RETRIES - 1);
-    final File localDir = FileUtils.createTempDirInLocation(temporaryFolder.toPath(), null);
+    final File localDir = temporaryFolder.newFolder();
     final File fetchedFile = shuffleClient.fetchSegmentFile(
         localDir,
         SUPERVISOR_TASK_ID,
@@ -126,7 +126,7 @@ public class HttpShuffleClientTest
       List<Future<File>> futures = new ArrayList<>();
       List<File> localDirs = new ArrayList<>();
       for (int i = 0; i < 2; i++) {
-        localDirs.add(FileUtils.createTempDirInLocation(temporaryFolder.toPath(), null));
+        localDirs.add(temporaryFolder.newFolder());
       }
       for (int i = 0; i < 2; i++) {
         final File localDir = localDirs.get(i);
@@ -158,7 +158,7 @@ public class HttpShuffleClientTest
       List<Future<File>> futures = new ArrayList<>();
       List<File> localDirs = new ArrayList<>();
       for (int i = 0; i < 2; i++) {
-        localDirs.add(FileUtils.createTempDirInLocation(temporaryFolder.toPath(), null));
+        localDirs.add(temporaryFolder.newFolder());
       }
       for (int i = 0; i < 2; i++) {
         final File localDir = localDirs.get(i);
diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/MultiPhaseParallelIndexingRowStatsTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/MultiPhaseParallelIndexingRowStatsTest.java
index 2096cdd9b9c..52852ad922b 100644
--- a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/MultiPhaseParallelIndexingRowStatsTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/MultiPhaseParallelIndexingRowStatsTest.java
@@ -80,7 +80,7 @@ public class MultiPhaseParallelIndexingRowStatsTest extends AbstractMultiPhasePa
   @BeforeEach
   public void setup() throws IOException
   {
-    inputDir = createTempDir("data");
+    inputDir = temporaryFolder.newFolder("data");
 
     // set up data
     for (int i = 0; i < 10; i++) {
diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/ParallelIndexPhaseRunnerTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/ParallelIndexPhaseRunnerTest.java
index e29ff1a05dc..744ca1b391a 100644
--- a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/ParallelIndexPhaseRunnerTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/ParallelIndexPhaseRunnerTest.java
@@ -52,7 +52,7 @@ public class ParallelIndexPhaseRunnerTest extends AbstractParallelIndexSuperviso
   @BeforeEach
   public void setup() throws IOException
   {
-    inputDir = createTempDir("data");
+    inputDir = temporaryFolder.newFolder("data");
     // set up data
     for (int i = 0; i < 5; i++) {
       try (final Writer writer =
diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/PartialCompactionTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/PartialCompactionTest.java
index 314998f7b5a..0992ffa5ddc 100644
--- a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/PartialCompactionTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/PartialCompactionTest.java
@@ -83,7 +83,7 @@ public class PartialCompactionTest extends AbstractMultiPhaseParallelIndexingTes
   @BeforeEach
   public void setup() throws IOException
   {
-    inputDir = createTempDir("data");
+    inputDir = temporaryFolder.newFolder("data");
     // set up data
     for (int i = 0; i < 10; i++) {
       try (final Writer writer =
diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/PartialDimensionCardinalityTaskTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/PartialDimensionCardinalityTaskTest.java
index 03666cec1d9..d5fc1a3868c 100644
--- a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/PartialDimensionCardinalityTaskTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/PartialDimensionCardinalityTaskTest.java
@@ -51,19 +51,17 @@ import org.apache.druid.server.security.Action;
 import org.apache.druid.server.security.Resource;
 import org.apache.druid.server.security.ResourceAction;
 import org.apache.druid.server.security.ResourceType;
-import org.apache.druid.testing.junit.LoggerCaptureRule;
+import org.apache.druid.testing.TemporaryFolderExtension;
+import org.apache.druid.testing.junit.LoggerCaptureExtension;
 import org.apache.logging.log4j.core.LogEvent;
 import org.easymock.Capture;
 import org.easymock.EasyMock;
 import org.joda.time.Interval;
-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 org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
-import java.io.File;
-import java.io.IOException;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
@@ -148,9 +146,10 @@ public class PartialDimensionCardinalityTaskTest
 
   public static class RunTaskTest
   {
-    @TempDir
-    private File temporaryFolder;
-    private final LoggerCaptureRule logger = new LoggerCaptureRule(ParseExceptionHandler.class);
+    @RegisterExtension
+    private final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
+    @RegisterExtension
+    private final LoggerCaptureExtension logger = new LoggerCaptureExtension(ParseExceptionHandler.class);
 
     private Capture<SubTaskReport> reportCapture;
     private TaskToolbox taskToolbox;
@@ -158,13 +157,12 @@ public class PartialDimensionCardinalityTaskTest
     @BeforeEach
     public void setup()
     {
-      logger.before();
       reportCapture = Capture.newInstance();
       ParallelIndexSupervisorTaskClient taskClient = EasyMock.mock(ParallelIndexSupervisorTaskClient.class);
       taskClient.report(EasyMock.capture(reportCapture));
       EasyMock.replay(taskClient);
       taskToolbox = EasyMock.mock(TaskToolbox.class);
-      EasyMock.expect(taskToolbox.getIndexingTmpDir()).andStubReturn(temporaryFolder);
+      EasyMock.expect(taskToolbox.getIndexingTmpDir()).andStubReturn(temporaryFolder.getRoot());
       EasyMock.expect(taskToolbox.getSupervisorTaskClientProvider())
               .andReturn((supervisorTaskId, httpTimeout, numRetries) -> taskClient);
       EasyMock.expect(taskToolbox.getOverlordClient()).andReturn(null);
@@ -172,12 +170,6 @@ public class PartialDimensionCardinalityTaskTest
       EasyMock.replay(taskToolbox);
     }
 
-    @AfterEach
-    public void tearDown() throws IOException
-    {
-      logger.after();
-    }
-
     @Test
     public void requiresPartitionDimension() throws Exception
     {
diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/PartialDimensionDistributionTaskTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/PartialDimensionDistributionTaskTest.java
index 75468b7697a..5c1bec3b879 100644
--- a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/PartialDimensionDistributionTaskTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/PartialDimensionDistributionTaskTest.java
@@ -43,20 +43,18 @@ import org.apache.druid.server.security.Action;
 import org.apache.druid.server.security.Resource;
 import org.apache.druid.server.security.ResourceAction;
 import org.apache.druid.server.security.ResourceType;
-import org.apache.druid.testing.junit.LoggerCaptureRule;
+import org.apache.druid.testing.TemporaryFolderExtension;
+import org.apache.druid.testing.junit.LoggerCaptureExtension;
 import org.apache.druid.timeline.partition.PartitionBoundaries;
 import org.apache.logging.log4j.core.LogEvent;
 import org.easymock.Capture;
 import org.easymock.EasyMock;
 import org.joda.time.Interval;
-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 org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
-import java.io.File;
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -120,9 +118,10 @@ public class PartialDimensionDistributionTaskTest
 
   public static class RunTaskTest
   {
-    @TempDir
-    private File temporaryFolder;
-    private final LoggerCaptureRule logger = new LoggerCaptureRule(ParseExceptionHandler.class);
+    @RegisterExtension
+    private final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
+    @RegisterExtension
+    private final LoggerCaptureExtension logger = new LoggerCaptureExtension(ParseExceptionHandler.class);
 
     private Capture<SubTaskReport> reportCapture;
     private TaskToolbox taskToolbox;
@@ -130,13 +129,12 @@ public class PartialDimensionDistributionTaskTest
     @BeforeEach
     public void setup()
     {
-      logger.before();
       reportCapture = Capture.newInstance();
       ParallelIndexSupervisorTaskClient taskClient = EasyMock.mock(ParallelIndexSupervisorTaskClient.class);
       taskClient.report(EasyMock.capture(reportCapture));
       EasyMock.replay(taskClient);
       taskToolbox = EasyMock.mock(TaskToolbox.class);
-      EasyMock.expect(taskToolbox.getIndexingTmpDir()).andStubReturn(temporaryFolder);
+      EasyMock.expect(taskToolbox.getIndexingTmpDir()).andStubReturn(temporaryFolder.getRoot());
       EasyMock.expect(taskToolbox.getSupervisorTaskClientProvider())
               .andReturn((supervisorTaskId, httpTimeout, numRetries) -> taskClient);
       EasyMock.expect(taskToolbox.getOverlordClient()).andReturn(null);
@@ -144,12 +142,6 @@ public class PartialDimensionDistributionTaskTest
       EasyMock.replay(taskToolbox);
     }
 
-    @AfterEach
-    public void tearDown() throws IOException
-    {
-      logger.after();
-    }
-
     @Test
     public void requiresPartitionDimensions() throws Exception
     {
diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/RangePartitionAdjustingCorePartitionSizeTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/RangePartitionAdjustingCorePartitionSizeTest.java
index 66f4397d9e4..2ec9c8add91 100644
--- a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/RangePartitionAdjustingCorePartitionSizeTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/RangePartitionAdjustingCorePartitionSizeTest.java
@@ -87,7 +87,7 @@ public class RangePartitionAdjustingCorePartitionSizeTest extends AbstractMultiP
   @Test
   public void testLessPartitionsThanBuckets() throws IOException
   {
-    final File inputDir = createTempDir();
+    final File inputDir = temporaryFolder.newFolder();
     for (int i = 0; i < 2; i++) {
       try (final Writer writer =
                Files.newBufferedWriter(new File(inputDir, "test_" + i).toPath(), StandardCharsets.UTF_8)) {
@@ -132,7 +132,7 @@ public class RangePartitionAdjustingCorePartitionSizeTest extends AbstractMultiP
   @Test
   public void testEqualNumberOfPartitionsToBuckets() throws IOException
   {
-    final File inputDir = createTempDir();
+    final File inputDir = temporaryFolder.newFolder();
     for (int i = 0; i < 10; i++) {
       try (final Writer writer =
                Files.newBufferedWriter(new File(inputDir, "test_" + i).toPath(), StandardCharsets.UTF_8)) {
diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/RangePartitionMultiPhaseParallelIndexingTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/RangePartitionMultiPhaseParallelIndexingTest.java
index 53a2bc233ef..9a9adb9bff5 100644
--- a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/RangePartitionMultiPhaseParallelIndexingTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/RangePartitionMultiPhaseParallelIndexingTest.java
@@ -135,7 +135,7 @@ public class RangePartitionMultiPhaseParallelIndexingTest extends AbstractMultiP
   @BeforeEach
   public void setup() throws IOException
   {
-    inputDir = createTempDir("data");
+    inputDir = temporaryFolder.newFolder("data");
     intervalToDims = createInputFiles(inputDir, useMultivalueDim);
   }
 
@@ -270,7 +270,7 @@ public class RangePartitionMultiPhaseParallelIndexingTest extends AbstractMultiP
       return;
     }
 
-    File inputDirectory = createTempDir("dataReplace");
+    File inputDirectory = temporaryFolder.newFolder("dataReplace");
     createInputFilesForReplace(inputDirectory, useMultivalueDim);
 
     final DataSegmentsWithSchemas publishedDataSegmentsWithSchemasAfterReplace = runTask(runTestTask(
@@ -400,7 +400,7 @@ public class RangePartitionMultiPhaseParallelIndexingTest extends AbstractMultiP
     );
   }
 
-  private void assertRangePartitions(Set<DataSegment> publishedSegments)
+  private void assertRangePartitions(Set<DataSegment> publishedSegments) throws IOException
   {
     Multimap<Interval, DataSegment> intervalToSegments = ArrayListMultimap.create();
     publishedSegments.forEach(s -> intervalToSegments.put(s.getInterval(), s));
@@ -408,7 +408,7 @@ public class RangePartitionMultiPhaseParallelIndexingTest extends AbstractMultiP
     Set<Interval> publishedIntervals = intervalToSegments.keySet();
     assertHasExpectedIntervals(publishedIntervals);
 
-    File tempSegmentDir = createTempDir();
+    File tempSegmentDir = temporaryFolder.newFolder();
 
     intervalToSegments.asMap().forEach((interval, segments) -> {
       assertNumPartition(segments);
diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/RangePartitionTaskKillTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/RangePartitionTaskKillTest.java
index 1b932d3c56d..71dec25177f 100644
--- a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/RangePartitionTaskKillTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/RangePartitionTaskKillTest.java
@@ -97,7 +97,7 @@ public class RangePartitionTaskKillTest extends AbstractMultiPhaseParallelIndexi
   @BeforeEach
   public void setup() throws IOException
   {
-    inputDir = createTempDir("data");
+    inputDir = temporaryFolder.newFolder("data");
   }
 
   @Test
diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/SinglePhaseParallelIndexingTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/SinglePhaseParallelIndexingTest.java
index d76bc2d4fa8..ff16bb094af 100644
--- a/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/SinglePhaseParallelIndexingTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/indexing/common/task/batch/parallel/SinglePhaseParallelIndexingTest.java
@@ -123,7 +123,7 @@ public class SinglePhaseParallelIndexingTest extends AbstractParallelIndexSuperv
   @BeforeEach
   public void setup() throws IOException
   {
-    inputDir = createTempDir("data");
+    inputDir = temporaryFolder.newFolder("data");
     // set up data
     for (int i = 0; i < 5; i++) {
       try (final Writer writer =
diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/common/tasklogs/FileTaskLogsTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/common/tasklogs/FileTaskLogsTest.java
index e278e0d4f6e..1110c6658ab 100644
--- a/indexing-service/src/test/java/org/apache/druid/indexing/common/tasklogs/FileTaskLogsTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/indexing/common/tasklogs/FileTaskLogsTest.java
@@ -30,9 +30,10 @@ import org.apache.druid.indexing.common.config.FileTaskLogsConfig;
 import org.apache.druid.java.util.common.StringUtils;
 import org.apache.druid.segment.TestHelper;
 import org.apache.druid.tasklogs.TaskLogs;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.File;
 import java.io.IOException;
@@ -41,15 +42,15 @@ import java.util.Map;
 
 public class FileTaskLogsTest
 {
-  @TempDir
-  private File temporaryFolder;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   @Test
   public void testSimple() throws Exception
   {
-    final File tmpDir = temporaryFolder;
+    final File tmpDir = temporaryFolder.getRoot();
     final File logDir = new File(tmpDir, "druid/logs");
-    final File logFile = new File(tmpDir, "log");
+    final File logFile = temporaryFolder.newFile("log");
     Files.asCharSink(logFile, StandardCharsets.UTF_8).write("blah");
     final TaskLogs taskLogs = new FileTaskLogs(new FileTaskLogsConfig(logDir));
     taskLogs.pushTaskLog("foo", logFile);
@@ -66,9 +67,9 @@ public class FileTaskLogsTest
   public void testSimpleReport() throws Exception
   {
     final ObjectMapper mapper = TestHelper.makeJsonMapper();
-    final File tmpDir = temporaryFolder;
+    final File tmpDir = temporaryFolder.getRoot();
     final File logDir = new File(tmpDir, "druid/logs");
-    final File reportFile = new File(tmpDir, "report.json");
+    final File reportFile = temporaryFolder.newFile("report.json");
 
     final String taskId = "myTask";
     final TestTaskReport testReport = new TestTaskReport(taskId);
@@ -88,9 +89,9 @@ public class FileTaskLogsTest
   public void testSimpleStatus() throws Exception
   {
     final ObjectMapper mapper = TestHelper.makeJsonMapper();
-    final File tmpDir = temporaryFolder;
+    final File tmpDir = temporaryFolder.getRoot();
     final File logDir = new File(tmpDir, "druid/myTask");
-    final File statusFile = new File(tmpDir, "status.json");
+    final File statusFile = temporaryFolder.newFile("status.json");
 
     final String taskId = "myTask";
     final TaskStatus taskStatus = TaskStatus.success(taskId);
@@ -109,10 +110,10 @@ public class FileTaskLogsTest
   @Test
   public void testPushTaskLogDirCreationFails() throws Exception
   {
-    final File tmpDir = temporaryFolder;
+    final File tmpDir = temporaryFolder.getRoot();
     try {
       final File logDir = new File(tmpDir, "druid/logs");
-      final File logFile = new File(tmpDir, "log");
+      final File logFile = temporaryFolder.newFile("log");
       Files.asCharSink(logFile, StandardCharsets.UTF_8).write("blah");
 
       if (!tmpDir.setWritable(false)) {
@@ -137,9 +138,9 @@ public class FileTaskLogsTest
   @Test
   public void testKill() throws Exception
   {
-    final File tmpDir = temporaryFolder;
+    final File tmpDir = temporaryFolder.getRoot();
     final File logDir = new File(tmpDir, "logs");
-    final File logFile = new File(tmpDir, "log");
+    final File logFile = temporaryFolder.newFile("log");
     final TaskLogs taskLogs = new FileTaskLogs(new FileTaskLogsConfig(logDir));
 
     Files.asCharSink(logFile, StandardCharsets.UTF_8).write("log1content");
diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/input/DruidSegmentReaderTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/input/DruidSegmentReaderTest.java
index f890ed065ea..c5499775e39 100644
--- a/indexing-service/src/test/java/org/apache/druid/indexing/input/DruidSegmentReaderTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/indexing/input/DruidSegmentReaderTest.java
@@ -62,13 +62,14 @@ import org.apache.druid.segment.incremental.IncrementalIndexSchema;
 import org.apache.druid.segment.loading.NoopSegmentCacheManager;
 import org.apache.druid.segment.writeout.OnHeapMemorySegmentWriteOutMediumFactory;
 import org.apache.druid.testing.InitializedNullHandlingTest;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.apache.druid.timeline.DataSegment;
 import org.apache.druid.timeline.partition.TombstoneShardSpec;
 import org.joda.time.Interval;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.File;
 import java.io.IOException;
@@ -83,8 +84,8 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
 
 public class DruidSegmentReaderTest extends InitializedNullHandlingTest
 {
-  @TempDir
-  private File temporaryFolder;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   private File segmentDirectory;
   private long segmentSize;
@@ -147,7 +148,7 @@ public class DruidSegmentReaderTest extends InitializedNullHandlingTest
         ),
         ColumnsFilter.all(),
         null,
-        createTempDir()
+        temporaryFolder.newFolder()
     );
 
     Assertions.assertEquals(
@@ -243,7 +244,7 @@ public class DruidSegmentReaderTest extends InitializedNullHandlingTest
             new NotDimFilter(new SelectorDimFilter("a", "foo1", null)),
             new NotDimFilter(new SelectorDimFilter("b", "bar1", null))
         ),
-        createTempDir()
+        temporaryFolder.newFolder()
     );
 
     Assertions.assertEquals(Arrays.asList(rows.get(2), rows.get(1)), readRows(reader));
@@ -296,7 +297,7 @@ public class DruidSegmentReaderTest extends InitializedNullHandlingTest
         ),
         ColumnsFilter.all(),
         null,
-        createTempDir()
+        temporaryFolder.newFolder()
     );
 
     Assertions.assertEquals(
@@ -339,7 +340,7 @@ public class DruidSegmentReaderTest extends InitializedNullHandlingTest
         DimensionsSpec.builder().setDimensionExclusions(ImmutableList.of("__time", "strCol", "cnt", "met_s")).build(),
         ColumnsFilter.all(),
         null,
-        createTempDir()
+        temporaryFolder.newFolder()
     );
 
     Assertions.assertEquals(
@@ -387,7 +388,7 @@ public class DruidSegmentReaderTest extends InitializedNullHandlingTest
         ),
         ColumnsFilter.inclusionBased(ImmutableSet.of("__time", "strCol", "dblCol")),
         null,
-        createTempDir()
+        temporaryFolder.newFolder()
     );
 
     Assertions.assertEquals(
@@ -431,7 +432,7 @@ public class DruidSegmentReaderTest extends InitializedNullHandlingTest
         ),
         ColumnsFilter.inclusionBased(ImmutableSet.of("strCol", "dblCol")),
         null,
-        createTempDir()
+        temporaryFolder.newFolder()
     );
 
     Assertions.assertEquals(
@@ -473,7 +474,7 @@ public class DruidSegmentReaderTest extends InitializedNullHandlingTest
         ),
         ColumnsFilter.all(),
         new SelectorDimFilter("dblCol", "1.23", null),
-        createTempDir()
+        temporaryFolder.newFolder()
     );
 
     Assertions.assertEquals(
@@ -510,7 +511,7 @@ public class DruidSegmentReaderTest extends InitializedNullHandlingTest
         ),
         ColumnsFilter.all(),
         null,
-        createTempDir()
+        temporaryFolder.newFolder()
     );
 
     Assertions.assertEquals(
@@ -558,7 +559,7 @@ public class DruidSegmentReaderTest extends InitializedNullHandlingTest
         ),
         ColumnsFilter.all(),
         null,
-        createTempDir()
+        temporaryFolder.newFolder()
     );
 
     Assertions.assertEquals(
@@ -606,7 +607,7 @@ public class DruidSegmentReaderTest extends InitializedNullHandlingTest
         ),
         ColumnsFilter.all(),
         null,
-        createTempDir()
+        temporaryFolder.newFolder()
     );
 
     Assertions.assertEquals(
@@ -734,7 +735,7 @@ public class DruidSegmentReaderTest extends InitializedNullHandlingTest
                     .rows(rows)
                     .buildIncrementalIndex();
 
-    File segmentDirectory = createTempDir();
+    File segmentDirectory = temporaryFolder.newFolder();
     long segmentSize;
     try {
       TestHelper.getTestIndexMergerV9(
@@ -772,7 +773,7 @@ public class DruidSegmentReaderTest extends InitializedNullHandlingTest
         ),
         ColumnsFilter.all(),
         null,
-        createTempDir()
+        temporaryFolder.newFolder()
     );
 
     List<InputRow> readRows = readRows(reader);
@@ -846,7 +847,7 @@ public class DruidSegmentReaderTest extends InitializedNullHandlingTest
                     .rows(rows)
                     .buildIncrementalIndex();
 
-    File segmentDirectory = createTempDir();
+    File segmentDirectory = temporaryFolder.newFolder();
     long segmentSize;
     try {
       TestHelper.getTestIndexMergerV9(
@@ -884,7 +885,7 @@ public class DruidSegmentReaderTest extends InitializedNullHandlingTest
         ),
         ColumnsFilter.all(),
         null,
-        createTempDir()
+        temporaryFolder.newFolder()
     );
 
     List<InputRow> readRows = readRows(reader);
@@ -1021,7 +1022,7 @@ public class DruidSegmentReaderTest extends InitializedNullHandlingTest
                     .rows(rows)
                     .buildIncrementalIndex();
 
-    segmentDirectory = createTempDir();
+    segmentDirectory = temporaryFolder.newFolder();
 
     try {
       TestHelper.getTestIndexMergerV9(
@@ -1039,9 +1040,4 @@ public class DruidSegmentReaderTest extends InitializedNullHandlingTest
     }
   }
 
-  private File createTempDir()
-  {
-    return FileUtils.createTempDirInLocation(temporaryFolder.toPath(), "segment");
-  }
-
 }
diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/overlord/ForkingTaskRunnerTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/overlord/ForkingTaskRunnerTest.java
index 5917d7f72c3..51ffe8ac337 100644
--- a/indexing-service/src/test/java/org/apache/druid/indexing/overlord/ForkingTaskRunnerTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/indexing/overlord/ForkingTaskRunnerTest.java
@@ -51,11 +51,12 @@ import org.apache.druid.segment.indexing.DataSchema;
 import org.apache.druid.server.DruidNode;
 import org.apache.druid.server.log.StartupLoggingConfig;
 import org.apache.druid.tasklogs.NoopTaskLogs;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.assertj.core.util.Lists;
 import org.joda.time.Period;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import javax.annotation.Nonnull;
 import java.io.ByteArrayInputStream;
@@ -77,23 +78,13 @@ public class ForkingTaskRunnerTest
 {
 
   private static final ObjectMapper OBJECT_MAPPER = new DefaultObjectMapper();
-  @TempDir
-  private File temporaryFolder;
-
-  private File newTempFolder()
-  {
-    return FileUtils.createTempDirInLocation(temporaryFolder.toPath(), "tmp");
-  }
-
-  private File newTempFile() throws IOException
-  {
-    return File.createTempFile("tmp", null, temporaryFolder);
-  }
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   @Test
   public void testGetJavaCommandPrefersRunJavaScriptWhenPresent() throws IOException
   {
-    final File workingDir = newTempFolder();
+    final File workingDir = temporaryFolder.newFolder();
     final File binDir = new File(workingDir, "bin");
     FileUtils.mkdirp(binDir);
     Assertions.assertTrue(new File(binDir, "run-java").createNewFile());
@@ -108,7 +99,7 @@ public class ForkingTaskRunnerTest
   @Test
   public void testGetJavaCommandFallsBackToJavaWhenScriptAbsent() throws IOException
   {
-    final File workingDir = newTempFolder();
+    final File workingDir = temporaryFolder.newFolder();
     Assertions.assertEquals(
         "java",
         ForkingTaskRunner.getJavaCommand(null, workingDir)
@@ -124,7 +115,7 @@ public class ForkingTaskRunnerTest
   @Test
   public void testGetJavaCommandRespectsExplicitOverride() throws IOException
   {
-    final File workingDir = newTempFolder();
+    final File workingDir = temporaryFolder.newFolder();
     final File binDir = new File(workingDir, "bin");
     FileUtils.mkdirp(binDir);
     Assertions.assertTrue(new File(binDir, "run-java").createNewFile());
@@ -318,7 +309,7 @@ public class ForkingTaskRunnerTest
   {
     ObjectMapper mapper = new DefaultObjectMapper();
     Task task = NoopTask.create();
-    File file = newTempFolder();
+    File file = temporaryFolder.newFolder();
     TaskConfig taskConfig = makeDefaultTaskConfigBuilder()
         .setBaseTaskDir(file.toString())
         .build();
@@ -376,7 +367,7 @@ public class ForkingTaskRunnerTest
   {
     ObjectMapper mapper = new DefaultObjectMapper();
     Task task = NoopTask.create();
-    File file = newTempFolder();
+    File file = temporaryFolder.newFolder();
     TaskConfig taskConfig = makeDefaultTaskConfigBuilder()
         .setBaseTaskDir(file.toString())
         .build();
@@ -425,7 +416,7 @@ public class ForkingTaskRunnerTest
   @Test
   public void testGettingTheNextAttemptDir() throws IOException
   {
-    File file = newTempFolder();
+    File file = temporaryFolder.newFolder();
     TaskConfig taskConfig = makeDefaultTaskConfigBuilder()
         .setBaseTaskDir(file.toString())
         .build();
@@ -448,7 +439,7 @@ public class ForkingTaskRunnerTest
   @Test
   public void testGettingTheNextAttemptDirFailsIfAttemptDirectoryCannotBeCreated() throws IOException
   {
-    final File taskDir = newTempFile();
+    final File taskDir = temporaryFolder.newFile();
     final File attemptDir = new File(taskDir, "attempt");
 
     final ISE exception = Assertions.assertThrows(
@@ -463,7 +454,7 @@ public class ForkingTaskRunnerTest
   @Test
   public void testGettingTheNextAttemptDirFailsIfAttemptCannotBeCreated() throws IOException
   {
-    final File taskDir = newTempFolder();
+    final File taskDir = temporaryFolder.newFolder();
     final File attemptDir = new File(taskDir, "attempt");
     FileUtils.mkdirp(attemptDir);
     final File attempt = new File(attemptDir, "1");
@@ -602,12 +593,13 @@ public class ForkingTaskRunnerTest
   public void testCannotRestoreTasks() throws Exception
   {
     TaskConfig taskConfig = makeDefaultTaskConfigBuilder()
+        .setGracefulShutdownTimeout(new Period("PT1S"))
         .build();
 
     TaskStorageDirTracker dirTracker = TaskStorageDirTracker.fromBaseDirs(
         ImmutableList.of(
-            newTempFolder().getAbsoluteFile(),
-            newTempFolder().getAbsoluteFile()
+            temporaryFolder.newFolder().getAbsoluteFile(),
+            temporaryFolder.newFolder().getAbsoluteFile()
         ),
         1,
         100_000_000_000_000_000L
@@ -633,8 +625,13 @@ public class ForkingTaskRunnerTest
 
     forkingTaskRunner.setNumProcessorsPerTask();
     Task task = NoopTask.create();
-    forkingTaskRunner.run(task);
-    Assertions.assertTrue(forkingTaskRunner.restore().isEmpty());
+    try {
+      forkingTaskRunner.run(task);
+      Assertions.assertTrue(forkingTaskRunner.restore().isEmpty());
+    }
+    finally {
+      forkingTaskRunner.stop();
+    }
   }
 
   @Test
diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/overlord/SingleTaskBackgroundRunnerTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/overlord/SingleTaskBackgroundRunnerTest.java
index 81d75b923f7..1845c38db52 100644
--- a/indexing-service/src/test/java/org/apache/druid/indexing/overlord/SingleTaskBackgroundRunnerTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/indexing/overlord/SingleTaskBackgroundRunnerTest.java
@@ -61,13 +61,14 @@ import org.apache.druid.server.coordination.NoopDataSegmentAnnouncer;
 import org.apache.druid.server.initialization.ServerConfig;
 import org.apache.druid.server.metrics.NoopServiceEmitter;
 import org.apache.druid.server.security.AuthTestUtils;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.apache.druid.utils.JvmUtils;
 import org.easymock.EasyMock;
 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 org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import javax.annotation.Nullable;
 import java.io.File;
@@ -81,8 +82,8 @@ import java.util.concurrent.atomic.AtomicReference;
 
 public class SingleTaskBackgroundRunnerTest
 {
-  @TempDir
-  private File temporaryFolder;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   private SingleTaskBackgroundRunner runner;
 
@@ -92,7 +93,7 @@ public class SingleTaskBackgroundRunnerTest
     final TestUtils utils = new TestUtils();
     final DruidNode node = new DruidNode("testServer", "testHost", false, 1000, null, true, false);
     final TaskConfig taskConfig = new TaskConfigBuilder()
-        .setBaseDir(File.createTempFile("base", null, temporaryFolder).toString())
+        .setBaseDir(temporaryFolder.newFile().toString())
         .setRestoreTasksOnRestart(true)
         .build();
     final ServiceEmitter emitter = new NoopServiceEmitter();
diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/overlord/TaskLifecycleTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/overlord/TaskLifecycleTest.java
index 55828b9f0c0..c3f160d4ec4 100644
--- a/indexing-service/src/test/java/org/apache/druid/indexing/overlord/TaskLifecycleTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/indexing/overlord/TaskLifecycleTest.java
@@ -137,6 +137,7 @@ import org.apache.druid.server.initialization.ServerConfig;
 import org.apache.druid.server.metrics.NoopServiceEmitter;
 import org.apache.druid.server.security.AuthTestUtils;
 import org.apache.druid.testing.InitializedNullHandlingTest;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.apache.druid.timeline.DataSegment;
 import org.apache.druid.timeline.partition.NoneShardSpec;
 import org.apache.druid.utils.JvmUtils;
@@ -149,7 +150,7 @@ 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 org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.params.ParameterizedClass;
 import org.junit.jupiter.params.provider.MethodSource;
 
@@ -201,8 +202,8 @@ public class TaskLifecycleTest extends InitializedNullHandlingTest
     this.taskStorageType = taskStorageType;
   }
 
-  @TempDir
-  private File temporaryFolder;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   private static final Ordering<DataSegment> BY_INTERVAL_ORDERING = new Ordering<>()
   {
@@ -229,11 +230,6 @@ public class TaskLifecycleTest extends InitializedNullHandlingTest
 
   private final TestDerbyConnector.DerbyConnectorRule derbyConnectorRule = new TestDerbyConnector.DerbyConnectorRule();
 
-  private File newTempFolder()
-  {
-    return FileUtils.createTempDirInLocation(temporaryFolder.toPath(), "tmp");
-  }
-
   private final String taskStorageType;
 
   private ObjectMapper mapper;
@@ -526,7 +522,7 @@ public class TaskLifecycleTest extends InitializedNullHandlingTest
       DataSegmentPusher dataSegmentPusher,
       SegmentHandoffNotifierFactory handoffNotifierFactory,
       TestIndexerMetadataStorageCoordinator mdc
-  )
+  ) throws IOException
   {
     return setUpTaskToolboxFactory(dataSegmentPusher, handoffNotifierFactory, mdc, new TestAppenderatorsManager());
   }
@@ -536,7 +532,7 @@ public class TaskLifecycleTest extends InitializedNullHandlingTest
       SegmentHandoffNotifierFactory handoffNotifierFactory,
       TestIndexerMetadataStorageCoordinator mdc,
       AppenderatorsManager appenderatorsManager
-  )
+  ) throws IOException
   {
     Preconditions.checkNotNull(queryRunnerFactoryConglomerate);
     Preconditions.checkNotNull(monitorScheduler);
@@ -555,7 +551,7 @@ public class TaskLifecycleTest extends InitializedNullHandlingTest
         )
     );
     taskConfig = new TaskConfigBuilder()
-        .setBaseDir(newTempFolder().toString())
+        .setBaseDir(temporaryFolder.newFolder().toString())
         .setTmpStorageBytesPerTask(-1L)
         .build();
 
@@ -769,7 +765,7 @@ public class TaskLifecycleTest extends InitializedNullHandlingTest
   @Test
   public void testKillUnusedSegmentsTask() throws Exception
   {
-    final File tmpSegmentDir = newTempFolder();
+    final File tmpSegmentDir = temporaryFolder.newFolder();
 
     List<DataSegment> expectedUnusedSegments = Lists.transform(
         ImmutableList.of(
@@ -867,7 +863,7 @@ public class TaskLifecycleTest extends InitializedNullHandlingTest
   @Test
   public void testKillUnusedSegmentsTaskWithMaxSegmentsToKill() throws Exception
   {
-    final File tmpSegmentDir = newTempFolder();
+    final File tmpSegmentDir = temporaryFolder.newFolder();
 
     List<DataSegment> expectedUnusedSegments = Lists.transform(
         ImmutableList.of(
diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/seekablestream/RecordSupplierInputSourceTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/seekablestream/RecordSupplierInputSourceTest.java
index 8f46a9fabec..8347a9f60d5 100644
--- a/indexing-service/src/test/java/org/apache/druid/indexing/seekablestream/RecordSupplierInputSourceTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/indexing/seekablestream/RecordSupplierInputSourceTest.java
@@ -41,17 +41,16 @@ import org.apache.druid.indexing.seekablestream.common.RecordSupplier;
 import org.apache.druid.indexing.seekablestream.common.StreamException;
 import org.apache.druid.indexing.seekablestream.common.StreamPartition;
 import org.apache.druid.java.util.common.DateTimes;
-import org.apache.druid.java.util.common.FileUtils;
 import org.apache.druid.java.util.common.StringUtils;
 import org.apache.druid.java.util.common.parsers.CloseableIterator;
 import org.apache.druid.testing.InitializedNullHandlingTest;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.mockito.Mockito;
 
 import javax.annotation.Nullable;
-import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -70,8 +69,8 @@ public class RecordSupplierInputSourceTest extends InitializedNullHandlingTest
   private static final int NUM_ROWS = 128;
   private static final String TIMESTAMP_STRING = "2019-01-01";
 
-  @TempDir
-  private File temporaryFolder;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   @Test
   public void testRead() throws IOException
@@ -89,7 +88,7 @@ public class RecordSupplierInputSourceTest extends InitializedNullHandlingTest
             ColumnsFilter.all()
         ),
         inputFormat,
-        FileUtils.createTempDirInLocation(temporaryFolder.toPath(), null)
+        temporaryFolder.newFolder()
     );
 
     int read = 0;
@@ -123,7 +122,7 @@ public class RecordSupplierInputSourceTest extends InitializedNullHandlingTest
             ColumnsFilter.all()
         ),
         inputFormat,
-        FileUtils.createTempDirInLocation(temporaryFolder.toPath(), null)
+        temporaryFolder.newFolder()
     );
 
     int read = 0;
diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/seekablestream/SeekableStreamIndexTaskRunnerTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/seekablestream/SeekableStreamIndexTaskRunnerTest.java
index 69c3a48c652..d6213864d52 100644
--- a/indexing-service/src/test/java/org/apache/druid/indexing/seekablestream/SeekableStreamIndexTaskRunnerTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/indexing/seekablestream/SeekableStreamIndexTaskRunnerTest.java
@@ -60,6 +60,7 @@ import org.apache.druid.segment.realtime.appenderator.StreamAppenderatorDriver;
 import org.apache.druid.server.coordination.ServerType;
 import org.apache.druid.server.coordinator.CreateDataSegments;
 import org.apache.druid.server.security.AuthTestUtils;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.apache.druid.timeline.DataSegment;
 import org.apache.druid.timeline.SegmentId;
 import org.apache.druid.timeline.partition.DimensionValueSetShardSpec;
@@ -70,7 +71,7 @@ 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 org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.mockito.Mock;
 import org.mockito.Mockito;
 import org.mockito.MockitoAnnotations;
@@ -103,8 +104,8 @@ public class SeekableStreamIndexTaskRunnerTest
 {
   private static final String DATA_SOURCE = "datasource";
 
-  @TempDir
-  private File temporaryFolder;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   @Mock
   private InputRow row;
@@ -763,8 +764,7 @@ public class SeekableStreamIndexTaskRunnerTest
   private File createTaskWorkDirectory()
   {
     try {
-      final File taskWorkDir = FileUtils.createTempDirInLocation(temporaryFolder.toPath(), null);
-      FileUtils.mkdirp(taskWorkDir);
+      final File taskWorkDir = temporaryFolder.newFolder();
       FileUtils.mkdirp(new File(taskWorkDir, "persist"));
       return taskWorkDir;
     }
diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/seekablestream/SeekableStreamIndexTaskTestBase.java b/indexing-service/src/test/java/org/apache/druid/indexing/seekablestream/SeekableStreamIndexTaskTestBase.java
index 8a75d17a80e..f7fb80308b1 100644
--- a/indexing-service/src/test/java/org/apache/druid/indexing/seekablestream/SeekableStreamIndexTaskTestBase.java
+++ b/indexing-service/src/test/java/org/apache/druid/indexing/seekablestream/SeekableStreamIndexTaskTestBase.java
@@ -72,7 +72,6 @@ import org.apache.druid.indexing.overlord.TaskStorage;
 import org.apache.druid.indexing.overlord.supervisor.SupervisorManager;
 import org.apache.druid.indexing.test.TestDataSegmentAnnouncer;
 import org.apache.druid.indexing.test.TestDataSegmentKiller;
-import org.apache.druid.java.util.common.FileUtils;
 import org.apache.druid.java.util.common.ISE;
 import org.apache.druid.java.util.common.Intervals;
 import org.apache.druid.java.util.common.StringUtils;
@@ -128,6 +127,7 @@ import org.apache.druid.server.coordination.ServerType;
 import org.apache.druid.server.coordinator.simulate.TestDruidLeaderSelector;
 import org.apache.druid.server.metrics.NoopServiceEmitter;
 import org.apache.druid.server.security.AuthTestUtils;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.apache.druid.timeline.DataSegment;
 import org.apache.druid.utils.CompressionUtils;
 import org.apache.druid.utils.JvmUtils;
@@ -137,7 +137,7 @@ import org.joda.time.Interval;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import javax.annotation.Nullable;
 import java.io.File;
@@ -162,8 +162,8 @@ public abstract class SeekableStreamIndexTaskTestBase extends EasyMockSupport
 {
   private static final Logger log = new Logger(SeekableStreamIndexTaskTestBase.class);
 
-  @TempDir
-  protected File tempFolder;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   public final TestDerbyConnector.DerbyConnectorRule derby = new TestDerbyConnector.DerbyConnectorRule();
 
@@ -560,7 +560,7 @@ public abstract class SeekableStreamIndexTaskTestBase extends EasyMockSupport
       throws IOException
   {
     final ObjectMapper objectMapper = testUtils.getTestObjectMapper();
-    directory = FileUtils.createTempDirInLocation(tempFolder.toPath(), null);
+    directory = temporaryFolder.newFolder();
     final TaskConfig taskConfig =
         new TaskConfigBuilder()
             .setBaseDir(new File(directory, "baseDir").getPath())
diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/seekablestream/StreamChunkReaderTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/seekablestream/StreamChunkReaderTest.java
index 20212fb2f21..9acee174b98 100644
--- a/indexing-service/src/test/java/org/apache/druid/indexing/seekablestream/StreamChunkReaderTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/indexing/seekablestream/StreamChunkReaderTest.java
@@ -33,7 +33,6 @@ import org.apache.druid.data.input.impl.TimestampSpec;
 import org.apache.druid.error.DruidException;
 import org.apache.druid.indexing.common.task.InputRowFilter;
 import org.apache.druid.java.util.common.DateTimes;
-import org.apache.druid.java.util.common.FileUtils;
 import org.apache.druid.java.util.common.RE;
 import org.apache.druid.java.util.common.StringUtils;
 import org.apache.druid.java.util.common.parsers.JSONPathSpec;
@@ -46,11 +45,12 @@ import org.apache.druid.segment.incremental.ParseExceptionHandler;
 import org.apache.druid.segment.incremental.RowIngestionMeters;
 import org.apache.druid.segment.incremental.SimpleRowIngestionMeters;
 import org.apache.druid.segment.transform.TransformSpec;
+import org.apache.druid.testing.TemporaryFolderExtension;
 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 org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.mockito.Mock;
 import org.mockito.Mockito;
 import org.mockito.MockitoAnnotations;
@@ -65,8 +65,8 @@ import java.util.Map;
 
 public class StreamChunkReaderTest
 {
-  @TempDir
-  private File temporaryFolder;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   private final RowIngestionMeters rowIngestionMeters = new SimpleRowIngestionMeters();
   private final ParseExceptionHandler parseExceptionHandler = new ParseExceptionHandler(
@@ -102,7 +102,7 @@ public class StreamChunkReaderTest
         inputFormat,
         new InputRowSchema(TimestampSpec.DEFAULT, DimensionsSpec.EMPTY, ColumnsFilter.all()),
         TransformSpec.NONE,
-        FileUtils.createTempDirInLocation(temporaryFolder.toPath(), null),
+        temporaryFolder.newFolder(),
         InputRowFilter.allowAll(),
         rowIngestionMeters,
         parseExceptionHandler
@@ -140,7 +140,7 @@ public class StreamChunkReaderTest
         inputFormat,
         new InputRowSchema(TimestampSpec.DEFAULT, DimensionsSpec.EMPTY, ColumnsFilter.all()),
         TransformSpec.NONE,
-        FileUtils.createTempDirInLocation(temporaryFolder.toPath(), null),
+        temporaryFolder.newFolder(),
         InputRowFilter.allowAll(),
         rowIngestionMeters,
         parseExceptionHandler
@@ -162,7 +162,7 @@ public class StreamChunkReaderTest
         inputFormat,
         new InputRowSchema(TimestampSpec.DEFAULT, DimensionsSpec.EMPTY, ColumnsFilter.all()),
         TransformSpec.NONE,
-        FileUtils.createTempDirInLocation(temporaryFolder.toPath(), null),
+        temporaryFolder.newFolder(),
         InputRowFilter.allowAll(),
         rowIngestionMeters,
         parseExceptionHandler
@@ -194,7 +194,7 @@ public class StreamChunkReaderTest
         inputFormat,
         new InputRowSchema(TimestampSpec.DEFAULT, DimensionsSpec.EMPTY, ColumnsFilter.all()),
         transformSpec,
-        FileUtils.createTempDirInLocation(temporaryFolder.toPath(), null),
+        temporaryFolder.newFolder(),
         InputRowFilter.allowAll(),
         rowIngestionMeters,
         parseExceptionHandler
@@ -253,7 +253,7 @@ public class StreamChunkReaderTest
         inputFormat,
         new InputRowSchema(TimestampSpec.DEFAULT, DimensionsSpec.EMPTY, ColumnsFilter.all()),
         transformSpec,
-        FileUtils.createTempDirInLocation(temporaryFolder.toPath(), null),
+        temporaryFolder.newFolder(),
         rowFilter,
         rowIngestionMeters,
         parseExceptionHandler
diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/worker/shuffle/LocalIntermediaryDataManagerAutoCleanupTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/worker/shuffle/LocalIntermediaryDataManagerAutoCleanupTest.java
index 7cb831d7432..139beb8e6ac 100644
--- a/indexing-service/src/test/java/org/apache/druid/indexing/worker/shuffle/LocalIntermediaryDataManagerAutoCleanupTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/indexing/worker/shuffle/LocalIntermediaryDataManagerAutoCleanupTest.java
@@ -33,6 +33,7 @@ import org.apache.druid.java.util.common.Intervals;
 import org.apache.druid.rpc.indexing.NoopOverlordClient;
 import org.apache.druid.rpc.indexing.OverlordClient;
 import org.apache.druid.segment.loading.StorageLocationConfig;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.apache.druid.timeline.DataSegment;
 import org.apache.druid.timeline.partition.BucketNumberedShardSpec;
 import org.apache.druid.timeline.partition.BuildingShardSpec;
@@ -43,7 +44,7 @@ import org.joda.time.Period;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.File;
 import java.io.IOException;
@@ -55,8 +56,8 @@ import java.util.Set;
 
 public class LocalIntermediaryDataManagerAutoCleanupTest
 {
-  @TempDir
-  private File tempDir;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   private TaskConfig taskConfig;
   private OverlordClient overlordClient;
@@ -65,7 +66,9 @@ public class LocalIntermediaryDataManagerAutoCleanupTest
   public void setup() throws IOException
   {
     this.taskConfig = new TaskConfigBuilder()
-        .setShuffleDataLocations(ImmutableList.of(new StorageLocationConfig(newTempDir("shuffle"), null, null)))
+        .setShuffleDataLocations(
+            ImmutableList.of(new StorageLocationConfig(temporaryFolder.newFolder("shuffle"), null, null))
+        )
         .build();
     this.overlordClient = new NoopOverlordClient()
     {
@@ -147,19 +150,12 @@ public class LocalIntermediaryDataManagerAutoCleanupTest
   private File generateSegmentDir(String fileName) throws IOException
   {
     // Each file size is 138 bytes after compression
-    final File segmentDir = newTempDir("segment");
+    final File segmentDir = temporaryFolder.newFolder("segment");
     FileUtils.write(new File(segmentDir, fileName), "test data.", StandardCharsets.UTF_8);
     FileUtils.writeByteArrayToFile(new File(segmentDir, "version.bin"), Ints.toByteArray(9));
     return segmentDir;
   }
 
-  private File newTempDir(String name) throws IOException
-  {
-    final File directory = new File(tempDir, name);
-    org.apache.druid.java.util.common.FileUtils.mkdirp(directory);
-    return directory;
-  }
-
   private DataSegment newSegment(Interval interval)
   {
     return new DataSegment(
diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/worker/shuffle/LocalIntermediaryDataManagerConcurrencyTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/worker/shuffle/LocalIntermediaryDataManagerConcurrencyTest.java
index 4f88b359932..17fc6a53eef 100644
--- a/indexing-service/src/test/java/org/apache/druid/indexing/worker/shuffle/LocalIntermediaryDataManagerConcurrencyTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/indexing/worker/shuffle/LocalIntermediaryDataManagerConcurrencyTest.java
@@ -30,6 +30,7 @@ import org.apache.druid.java.util.common.concurrent.Execs;
 import org.apache.druid.rpc.indexing.NoopOverlordClient;
 import org.apache.druid.rpc.indexing.OverlordClient;
 import org.apache.druid.segment.loading.StorageLocationConfig;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.apache.druid.timeline.DataSegment;
 import org.apache.druid.timeline.partition.BucketNumberedShardSpec;
 import org.apache.druid.timeline.partition.BuildingShardSpec;
@@ -41,7 +42,7 @@ import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.Timeout;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.File;
 import java.io.IOException;
@@ -69,8 +70,8 @@ public class LocalIntermediaryDataManagerConcurrencyTest
   private static final int CALLS_PER_THREAD = 200;
   private static final String SUPERVISOR_TASK_ID = "supervisorTaskId";
 
-  @TempDir
-  private File tempDir;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   private LocalIntermediaryDataManager intermediaryDataManager;
   private File sharedSegmentDir;
@@ -81,7 +82,9 @@ public class LocalIntermediaryDataManagerConcurrencyTest
     final WorkerConfig workerConfig = new WorkerConfig();
     final ImmutableList.Builder<StorageLocationConfig> locations = ImmutableList.builder();
     for (int i = 0; i < LOCATION_COUNT; i++) {
-      locations.add(new StorageLocationConfig(newTempDir("loc_" + i), LOCATION_CAPACITY_BYTES, null));
+      locations.add(
+          new StorageLocationConfig(temporaryFolder.newFolder("loc_" + i), LOCATION_CAPACITY_BYTES, null)
+      );
     }
     final TaskConfig taskConfig = new TaskConfigBuilder()
         .setShuffleDataLocations(locations.build())
@@ -90,7 +93,7 @@ public class LocalIntermediaryDataManagerConcurrencyTest
     intermediaryDataManager = new LocalIntermediaryDataManager(workerConfig, taskConfig, overlordClient);
     intermediaryDataManager.start();
     // Pre-built shared input dir keeps per-call work small so the race window dominates wall time.
-    sharedSegmentDir = newTempDir("shared_input");
+    sharedSegmentDir = temporaryFolder.newFolder("shared_input");
     FileUtils.write(new File(sharedSegmentDir, "data.txt"), "x", StandardCharsets.UTF_8);
     FileUtils.writeByteArrayToFile(new File(sharedSegmentDir, "version.bin"), Ints.toByteArray(9));
   }
@@ -134,13 +137,6 @@ public class LocalIntermediaryDataManagerConcurrencyTest
     Assertions.assertTrue(executor.awaitTermination(10, TimeUnit.SECONDS));
   }
 
-  private File newTempDir(String name) throws IOException
-  {
-    final File directory = new File(tempDir, name);
-    org.apache.druid.java.util.common.FileUtils.mkdirp(directory);
-    return directory;
-  }
-
   private DataSegment newSegment(Interval interval, int bucketId)
   {
     return new DataSegment(
diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/worker/shuffle/LocalIntermediaryDataManagerManualAddAndDeleteTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/worker/shuffle/LocalIntermediaryDataManagerManualAddAndDeleteTest.java
index 2a32a57a80a..675a69ce729 100644
--- a/indexing-service/src/test/java/org/apache/druid/indexing/worker/shuffle/LocalIntermediaryDataManagerManualAddAndDeleteTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/indexing/worker/shuffle/LocalIntermediaryDataManagerManualAddAndDeleteTest.java
@@ -32,6 +32,7 @@ import org.apache.druid.java.util.common.StringUtils;
 import org.apache.druid.rpc.indexing.NoopOverlordClient;
 import org.apache.druid.rpc.indexing.OverlordClient;
 import org.apache.druid.segment.loading.StorageLocationConfig;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.apache.druid.timeline.DataSegment;
 import org.apache.druid.timeline.partition.BucketNumberedShardSpec;
 import org.apache.druid.timeline.partition.BuildingShardSpec;
@@ -42,7 +43,7 @@ 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 org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.File;
 import java.io.IOException;
@@ -52,8 +53,8 @@ import java.util.Optional;
 
 public class LocalIntermediaryDataManagerManualAddAndDeleteTest
 {
-  @TempDir
-  private File tempDir;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   private LocalIntermediaryDataManager intermediaryDataManager;
   private File intermediarySegmentsLocation;
@@ -63,8 +64,8 @@ public class LocalIntermediaryDataManagerManualAddAndDeleteTest
   public void setup() throws IOException
   {
     final WorkerConfig workerConfig = new WorkerConfig();
-    intermediarySegmentsLocation = newTempDir("intermediary");
-    siblingLocation = newTempDir("sibling");
+    intermediarySegmentsLocation = temporaryFolder.newFolder("intermediary");
+    siblingLocation = temporaryFolder.newFolder("sibling");
     final TaskConfig taskConfig = new TaskConfigBuilder()
         .setShuffleDataLocations(ImmutableList.of(new StorageLocationConfig(intermediarySegmentsLocation, 1200L, null)))
         .build();
@@ -245,19 +246,12 @@ public class LocalIntermediaryDataManagerManualAddAndDeleteTest
   private File generateSegmentDir(String fileName) throws IOException
   {
     // Each file size is 138 bytes after compression
-    final File segmentDir = newTempDir(fileName);
+    final File segmentDir = temporaryFolder.newFolder(fileName);
     FileUtils.write(new File(segmentDir, fileName), "test data.", StandardCharsets.UTF_8);
     FileUtils.writeByteArrayToFile(new File(segmentDir, "version.bin"), Ints.toByteArray(9));
     return segmentDir;
   }
 
-  private File newTempDir(String name) throws IOException
-  {
-    final File directory = new File(tempDir, name);
-    org.apache.druid.java.util.common.FileUtils.mkdirp(directory);
-    return directory;
-  }
-
   private DataSegment newSegment(Interval interval, int bucketId)
   {
     return new DataSegment(
diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/worker/shuffle/ShuffleDataSegmentPusherTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/worker/shuffle/ShuffleDataSegmentPusherTest.java
index ce26b93de3c..bcd879ff8f5 100644
--- a/indexing-service/src/test/java/org/apache/druid/indexing/worker/shuffle/ShuffleDataSegmentPusherTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/indexing/worker/shuffle/ShuffleDataSegmentPusherTest.java
@@ -45,6 +45,7 @@ import org.apache.druid.segment.loading.LocalDataSegmentPusherConfig;
 import org.apache.druid.segment.loading.LocalLoadSpec;
 import org.apache.druid.segment.loading.SegmentLoadingException;
 import org.apache.druid.segment.loading.StorageLocationConfig;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.apache.druid.timeline.DataSegment;
 import org.apache.druid.timeline.partition.BucketNumberedShardSpec;
 import org.apache.druid.utils.CompressionUtils;
@@ -53,7 +54,7 @@ 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 org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.params.Parameter;
 import org.junit.jupiter.params.ParameterizedClass;
 import org.junit.jupiter.params.provider.MethodSource;
@@ -83,8 +84,8 @@ public class ShuffleDataSegmentPusherTest
   @Parameter(0)
   public String intermediateDataStore;
 
-  @TempDir
-  private File tempDir;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   private IntermediaryDataManager intermediaryDataManager;
   private ShuffleDataSegmentPusher segmentPusher;
@@ -97,13 +98,15 @@ public class ShuffleDataSegmentPusherTest
   {
     final WorkerConfig workerConfig = new WorkerConfig();
     final TaskConfig taskConfig = new TaskConfigBuilder()
-        .setShuffleDataLocations(ImmutableList.of(new StorageLocationConfig(newTempDir("shuffle"), null, null)))
+        .setShuffleDataLocations(
+            ImmutableList.of(new StorageLocationConfig(temporaryFolder.newFolder("shuffle"), null, null))
+        )
         .build();
     final OverlordClient overlordClient = new NoopOverlordClient();
     if (LOCAL.equals(intermediateDataStore)) {
       intermediaryDataManager = new LocalIntermediaryDataManager(workerConfig, taskConfig, overlordClient);
     } else if (DEEPSTORE.equals(intermediateDataStore)) {
-      localDeepStore = newTempDir("localStorage");
+      localDeepStore = temporaryFolder.newFolder("localStorage");
       intermediaryDataManager = new DeepStorageIntermediaryDataManager(
           new LocalDataSegmentPusher(
               new LocalDataSegmentPusherConfig()
@@ -149,7 +152,7 @@ public class ShuffleDataSegmentPusherTest
     Assertions.assertEquals(9, pushed.getBinaryVersion().intValue());
     Assertions.assertEquals(14, pushed.getSize()); // 10 bytes data + 4 bytes version
 
-    final File tempDir = newTempDir("unzipped");
+    final File tempDir = temporaryFolder.newFolder("unzipped");
     if (intermediaryDataManager instanceof LocalIntermediaryDataManager) {
       final Optional<ByteSource> zippedSegment = intermediaryDataManager.findPartitionFile(
           "supervisorTaskId",
@@ -191,19 +194,12 @@ public class ShuffleDataSegmentPusherTest
   private File generateSegmentDir() throws IOException
   {
     // Each file size is 138 bytes after compression
-    final File segmentDir = newTempDir("segment");
+    final File segmentDir = temporaryFolder.newFolder("segment");
     Files.asByteSink(new File(segmentDir, "version.bin")).write(Ints.toByteArray(0x9));
     FileUtils.write(new File(segmentDir, "test"), "test data.", StandardCharsets.UTF_8);
     return segmentDir;
   }
 
-  private File newTempDir(String name) throws IOException
-  {
-    final File directory = new File(tempDir, name);
-    org.apache.druid.java.util.common.FileUtils.mkdirp(directory);
-    return directory;
-  }
-
   private DataSegment newSegment(Interval interval)
   {
     BucketNumberedShardSpec<?> shardSpec = Mockito.mock(BucketNumberedShardSpec.class);
diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/worker/shuffle/ShuffleResourceTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/worker/shuffle/ShuffleResourceTest.java
index f83e3c3782e..08c589102ae 100644
--- a/indexing-service/src/test/java/org/apache/druid/indexing/worker/shuffle/ShuffleResourceTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/indexing/worker/shuffle/ShuffleResourceTest.java
@@ -34,6 +34,7 @@ import org.apache.druid.java.util.common.Intervals;
 import org.apache.druid.rpc.indexing.NoopOverlordClient;
 import org.apache.druid.rpc.indexing.OverlordClient;
 import org.apache.druid.segment.loading.StorageLocationConfig;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.apache.druid.timeline.DataSegment;
 import org.apache.druid.timeline.partition.BucketNumberedShardSpec;
 import org.easymock.EasyMock;
@@ -42,7 +43,7 @@ import org.joda.time.Period;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.mockito.Mockito;
 
 import javax.ws.rs.core.Response;
@@ -59,8 +60,8 @@ public class ShuffleResourceTest
 {
   private static final String DATASOURCE = "datasource";
 
-  @TempDir
-  private File tempDir;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   private LocalIntermediaryDataManager intermediaryDataManager;
   private ShuffleMetrics shuffleMetrics;
@@ -91,7 +92,9 @@ public class ShuffleResourceTest
 
     };
     final TaskConfig taskConfig = new TaskConfigBuilder()
-        .setShuffleDataLocations(ImmutableList.of(new StorageLocationConfig(newTempDir("shuffle"), null, null)))
+        .setShuffleDataLocations(
+            ImmutableList.of(new StorageLocationConfig(temporaryFolder.newFolder("shuffle"), null, null))
+        )
         .build();
     final OverlordClient overlordClient = new NoopOverlordClient()
     {
@@ -204,16 +207,10 @@ public class ShuffleResourceTest
   private File generateSegmentDir(String fileName) throws IOException
   {
     // Each file size is 138 bytes after compression
-    final File segmentDir = newTempDir(fileName);
+    final File segmentDir = temporaryFolder.newFolder(fileName);
     FileUtils.write(new File(segmentDir, fileName), "test data.", StandardCharsets.UTF_8);
     FileUtils.writeByteArrayToFile(new File(segmentDir, "version.bin"), Ints.toByteArray(9));
     return segmentDir;
   }
 
-  private File newTempDir(String name) throws IOException
-  {
-    final File directory = new File(tempDir, name);
-    org.apache.druid.java.util.common.FileUtils.mkdirp(directory);
-    return directory;
-  }
 }
diff --git a/indexing-service/src/test/java/org/apache/druid/metadata/MetadataStorageActionHandlerTest.java b/indexing-service/src/test/java/org/apache/druid/metadata/MetadataStorageActionHandlerTest.java
index 762d2999190..3085a427dfc 100644
--- a/indexing-service/src/test/java/org/apache/druid/metadata/MetadataStorageActionHandlerTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/metadata/MetadataStorageActionHandlerTest.java
@@ -27,7 +27,7 @@ import org.apache.druid.indexer.TaskStatus;
 import org.apache.druid.indexing.common.TaskLock;
 import org.apache.druid.indexing.common.task.Task;
 import org.joda.time.DateTime;
-import org.junit.Before;
+import org.junit.jupiter.api.BeforeEach;
 
 import javax.annotation.Nullable;
 import java.util.Collections;
@@ -44,7 +44,7 @@ public class MetadataStorageActionHandlerTest
 
   private MetadataStorageActionHandler handler;
 
-  @Before
+  @BeforeEach
   public void setup()
   {
     this.handler = new MetadataStorageActionHandler()
diff --git a/indexing-service/src/test/java/org/apache/druid/metadata/SQLMetadataStorageActionHandlerTest.java b/indexing-service/src/test/java/org/apache/druid/metadata/SQLMetadataStorageActionHandlerTest.java
index 84f958b56e6..303a915e430 100644
--- a/indexing-service/src/test/java/org/apache/druid/metadata/SQLMetadataStorageActionHandlerTest.java
+++ b/indexing-service/src/test/java/org/apache/druid/metadata/SQLMetadataStorageActionHandlerTest.java
@@ -45,10 +45,12 @@ import org.apache.druid.metadata.TaskLookup.CompleteTaskLookup;
 import org.joda.time.DateTime;
 import org.joda.time.DateTimeZone;
 import org.joda.time.Duration;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Timeout;
+import org.junit.jupiter.api.Timeout.ThreadMode;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.sql.ResultSet;
 import java.sql.Statement;
@@ -59,11 +61,12 @@ import java.util.Map;
 import java.util.Random;
 import java.util.Set;
 import java.util.UUID;
+import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 
 public class SQLMetadataStorageActionHandlerTest
 {
-  @Rule
+  @RegisterExtension
   public final TestDerbyConnector.DerbyConnectorRule derbyConnectorRule = new TestDerbyConnector.DerbyConnectorRule();
 
   private static final ObjectMapper JSON_MAPPER = new DefaultObjectMapper();
@@ -74,7 +77,7 @@ public class SQLMetadataStorageActionHandlerTest
 
   private final String entryTable = "entries";
 
-  @Before
+  @BeforeEach
   public void setUp()
   {
     TestDerbyConnector connector = derbyConnectorRule.getConnector();
@@ -103,50 +106,50 @@ public class SQLMetadataStorageActionHandlerTest
 
     handler.insert(entryId, DateTimes.of("2014-01-02T00:00:00.123"), "testDataSource", entry, true, null, "type", "group");
 
-    Assert.assertEquals(Optional.of(entry), handler.getEntry(entryId));
-    Assert.assertEquals(Optional.absent(), handler.getEntry("non_exist_entry"));
-    Assert.assertEquals(Optional.absent(), handler.getStatus(entryId));
-    Assert.assertEquals(Optional.absent(), handler.getStatus("non_exist_entry"));
-    Assert.assertTrue(handler.setStatus(entryId, true, status1));
+    Assertions.assertEquals(Optional.of(entry), handler.getEntry(entryId));
+    Assertions.assertEquals(Optional.absent(), handler.getEntry("non_exist_entry"));
+    Assertions.assertEquals(Optional.absent(), handler.getStatus(entryId));
+    Assertions.assertEquals(Optional.absent(), handler.getStatus("non_exist_entry"));
+    Assertions.assertTrue(handler.setStatus(entryId, true, status1));
 
-    Assert.assertEquals(
+    Assertions.assertEquals(
         ImmutableList.of(Pair.of(entry, status1)),
         handler.getTaskInfos(ActiveTaskLookup.getInstance(), null).stream()
                .map(taskInfo -> Pair.of(taskInfo.getTask(), taskInfo.getStatus()))
                .collect(Collectors.toList())
     );
 
-    Assert.assertTrue(handler.setStatus(entryId, true, status2));
+    Assertions.assertTrue(handler.setStatus(entryId, true, status2));
 
-    Assert.assertEquals(
+    Assertions.assertEquals(
         ImmutableList.of(Pair.of(entry, status2)),
         handler.getTaskInfos(ActiveTaskLookup.getInstance(), null).stream()
                .map(taskInfo -> Pair.of(taskInfo.getTask(), taskInfo.getStatus()))
                .collect(Collectors.toList())
     );
 
-    Assert.assertEquals(
+    Assertions.assertEquals(
         ImmutableList.of(),
         handler.getTaskInfos(CompleteTaskLookup.withTasksCreatedPriorTo(null, DateTimes.of("2014-01-01")), null)
     );
 
-    Assert.assertTrue(handler.setStatus(entryId, false, status1));
+    Assertions.assertTrue(handler.setStatus(entryId, false, status1));
 
-    Assert.assertEquals(
+    Assertions.assertEquals(
         Optional.of(status1),
         handler.getStatus(entryId)
     );
 
     // inactive statuses cannot be updated, this should fail
-    Assert.assertFalse(handler.setStatus(entryId, false, status2));
+    Assertions.assertFalse(handler.setStatus(entryId, false, status2));
 
-    Assert.assertEquals(Optional.of(status1), handler.getStatus(entryId));
-    Assert.assertEquals(Optional.of(entry), handler.getEntry(entryId));
-    Assert.assertEquals(
+    Assertions.assertEquals(Optional.of(status1), handler.getStatus(entryId));
+    Assertions.assertEquals(Optional.of(entry), handler.getEntry(entryId));
+    Assertions.assertEquals(
         ImmutableList.of(),
         handler.getTaskInfos(CompleteTaskLookup.withTasksCreatedPriorTo(null, DateTimes.of("2014-01-03")), null)
     );
-    Assert.assertEquals(
+    Assertions.assertEquals(
         ImmutableList.of(status1),
         handler.getTaskInfos(CompleteTaskLookup.withTasksCreatedPriorTo(null, DateTimes.of("2014-01-01")), null)
                .stream()
@@ -170,9 +173,9 @@ public class SQLMetadataStorageActionHandlerTest
         CompleteTaskLookup.withTasksCreatedPriorTo(7, DateTimes.of("2014-01-01")),
         null
     );
-    Assert.assertEquals(7, statuses.size());
+    Assertions.assertEquals(7, statuses.size());
     for (TaskInfo status : statuses) {
-      Assert.assertEquals(TaskState.RUNNING, status.getStatus().getStatusCode());
+      Assertions.assertEquals(TaskState.RUNNING, status.getStatus().getStatusCode());
     }
   }
 
@@ -191,13 +194,14 @@ public class SQLMetadataStorageActionHandlerTest
         CompleteTaskLookup.withTasksCreatedPriorTo(10, DateTimes.of("2014-01-01")),
         null
     );
-    Assert.assertEquals(5, statuses.size());
+    Assertions.assertEquals(5, statuses.size());
     for (TaskInfo status : statuses) {
-      Assert.assertEquals(TaskState.RUNNING, status.getStatus().getStatusCode());
+      Assertions.assertEquals(TaskState.RUNNING, status.getStatus().getStatusCode());
     }
   }
 
-  @Test(timeout = 60_000L)
+  @Test
+  @Timeout(value = 60_000L, unit = TimeUnit.MILLISECONDS, threadMode = ThreadMode.SEPARATE_THREAD)
   public void testDuplicateInsertThrowsEntryExistsException()
   {
     Task entry = NoopTask.create();
@@ -206,12 +210,12 @@ public class SQLMetadataStorageActionHandlerTest
 
     handler.insert(entryId, DateTimes.of("2014-01-01"), "test", entry, true, status, "type", "group");
 
-    DruidException exception = Assert.assertThrows(
+    DruidException exception = Assertions.assertThrows(
         DruidException.class,
         () -> handler.insert(entryId, DateTimes.of("2014-01-01"), "test", entry, true, status, "type", "group")
     );
-    Assert.assertEquals("invalidInput", exception.getErrorCode());
-    Assert.assertEquals(StringUtils.format("Task [%s] already exists", entryId), exception.getMessage());
+    Assertions.assertEquals("invalidInput", exception.getErrorCode());
+    Assertions.assertEquals(StringUtils.format("Task [%s] already exists", entryId), exception.getMessage());
   }
 
   @Test
@@ -223,20 +227,20 @@ public class SQLMetadataStorageActionHandlerTest
 
     handler.insert(entryId, DateTimes.of("2014-01-01"), "test", entry, true, status, "type", "group");
 
-    Assert.assertTrue(handler.getLocks("non_exist_entry").isEmpty());
+    Assertions.assertTrue(handler.getLocks("non_exist_entry").isEmpty());
 
-    Assert.assertTrue(handler.getLocks(entryId).isEmpty());
+    Assertions.assertTrue(handler.getLocks(entryId).isEmpty());
 
     final TaskLock lock1 = createRandomLock(entry);
     final TaskLock lock2 = createRandomLock(entry);
 
-    Assert.assertTrue(handler.addLock(entryId, lock1));
-    Assert.assertTrue(handler.addLock(entryId, lock2));
+    Assertions.assertTrue(handler.addLock(entryId, lock1));
+    Assertions.assertTrue(handler.addLock(entryId, lock2));
 
     final Map<Long, TaskLock> locks = handler.getLocks(entryId);
-    Assert.assertEquals(2, locks.size());
+    Assertions.assertEquals(2, locks.size());
 
-    Assert.assertEquals(
+    Assertions.assertEquals(
         Set.of(lock1, lock2),
         new HashSet<>(locks.values())
     );
@@ -246,11 +250,11 @@ public class SQLMetadataStorageActionHandlerTest
     locks.remove(lockId);
 
     final Map<Long, TaskLock> updated = handler.getLocks(entryId);
-    Assert.assertEquals(
+    Assertions.assertEquals(
         new HashSet<>(locks.values()),
         new HashSet<>(updated.values())
     );
-    Assert.assertEquals(updated.keySet(), locks.keySet());
+    Assertions.assertEquals(updated.keySet(), locks.keySet());
   }
 
   @Test
@@ -262,12 +266,12 @@ public class SQLMetadataStorageActionHandlerTest
 
     handler.insert(entryId, DateTimes.of("2014-01-01"), "test", entry, true, status, "type", "group");
 
-    Assert.assertEquals(
+    Assertions.assertEquals(
         ImmutableMap.<Long, Map<String, Object>>of(),
         handler.getLocks("non_exist_entry")
     );
 
-    Assert.assertEquals(
+    Assertions.assertEquals(
         ImmutableMap.<Long, Map<String, Object>>of(),
         handler.getLocks(entryId)
     );
@@ -275,12 +279,12 @@ public class SQLMetadataStorageActionHandlerTest
     final TaskLock lock1 = createRandomLock(entry);
     final TaskLock lock2 = createRandomLock(entry);
 
-    Assert.assertTrue(handler.addLock(entryId, lock1));
+    Assertions.assertTrue(handler.addLock(entryId, lock1));
 
     final Long lockId1 = handler.getLockId(entryId, lock1);
-    Assert.assertNotNull(lockId1);
+    Assertions.assertNotNull(lockId1);
 
-    Assert.assertTrue(handler.replaceLock(entryId, lockId1, lock2));
+    Assertions.assertTrue(handler.replaceLock(entryId, lockId1, lock2));
   }
 
   @Test
@@ -292,12 +296,12 @@ public class SQLMetadataStorageActionHandlerTest
 
     handler.insert(entryId, DateTimes.of("2014-01-01"), "test", entry, true, status, "type", "group");
 
-    Assert.assertEquals(
+    Assertions.assertEquals(
         ImmutableMap.<Long, Map<String, Object>>of(),
         handler.getLocks("non_exist_entry")
     );
 
-    Assert.assertEquals(
+    Assertions.assertEquals(
         ImmutableMap.<Long, Map<String, Object>>of(),
         handler.getLocks(entryId)
     );
@@ -305,10 +309,10 @@ public class SQLMetadataStorageActionHandlerTest
     final TaskLock lock1 = createRandomLock(entry);
     final TaskLock lock2 = createRandomLock(entry);
 
-    Assert.assertTrue(handler.addLock(entryId, lock1));
+    Assertions.assertTrue(handler.addLock(entryId, lock1));
 
-    Assert.assertNotNull(handler.getLockId(entryId, lock1));
-    Assert.assertNull(handler.getLockId(entryId, lock2));
+    Assertions.assertNotNull(handler.getLockId(entryId, lock1));
+    Assertions.assertNull(handler.getLockId(entryId, lock2));
   }
 
   @Test
@@ -329,18 +333,18 @@ public class SQLMetadataStorageActionHandlerTest
     TaskStatus status3 = TaskStatus.running(entryId2);
     handler.insert(entryId3, DateTimes.of("2014-01-02T12:00:00.123"), "testDataSource", entry3, false, status3, "type", "group");
 
-    Assert.assertEquals(Optional.of(entry1), handler.getEntry(entryId1));
-    Assert.assertEquals(Optional.of(entry2), handler.getEntry(entryId2));
-    Assert.assertEquals(Optional.of(entry3), handler.getEntry(entryId3));
+    Assertions.assertEquals(Optional.of(entry1), handler.getEntry(entryId1));
+    Assertions.assertEquals(Optional.of(entry2), handler.getEntry(entryId2));
+    Assertions.assertEquals(Optional.of(entry3), handler.getEntry(entryId3));
 
-    Assert.assertEquals(
+    Assertions.assertEquals(
         ImmutableList.of(entryId2),
         handler.getTaskInfos(ActiveTaskLookup.getInstance(), null).stream()
                .map(taskInfo -> taskInfo.getId())
                .collect(Collectors.toList())
     );
 
-    Assert.assertEquals(
+    Assertions.assertEquals(
         ImmutableList.of(entryId3, entryId1),
         handler.getTaskInfos(CompleteTaskLookup.withTasksCreatedPriorTo(null, DateTimes.of("2014-01-01")), null)
                .stream()
@@ -351,13 +355,13 @@ public class SQLMetadataStorageActionHandlerTest
 
     handler.removeTasksOlderThan(DateTimes.of("2014-01-02").getMillis());
     // active task not removed.
-    Assert.assertEquals(
+    Assertions.assertEquals(
         ImmutableList.of(entryId2),
         handler.getTaskInfos(ActiveTaskLookup.getInstance(), null).stream()
                .map(taskInfo -> taskInfo.getId())
                .collect(Collectors.toList())
     );
-    Assert.assertEquals(
+    Assertions.assertEquals(
         ImmutableList.of(entryId3),
         handler.getTaskInfos(CompleteTaskLookup.withTasksCreatedPriorTo(null, DateTimes.of("2014-01-01")), null)
                .stream()
@@ -380,11 +384,11 @@ public class SQLMetadataStorageActionHandlerTest
       insertTaskInfo(createRandomTaskInfo(TaskState.SUCCESS), false);
     }
 
-    Assert.assertEquals(numActiveTasks + numCompletedTasks, getUnmigratedTaskCount().intValue());
+    Assertions.assertEquals(numActiveTasks + numCompletedTasks, getUnmigratedTaskCount().intValue());
 
     handler.populateTaskTypeAndGroupId();
 
-    Assert.assertEquals(0, getUnmigratedTaskCount().intValue());
+    Assertions.assertEquals(0, getUnmigratedTaskCount().intValue());
   }
 
   @Test
@@ -413,7 +417,7 @@ public class SQLMetadataStorageActionHandlerTest
 
     // Payload based fetch. task type and groupid will be populated
     taskMetadataInfos = handler.getTaskStatusList(taskLookups, null, true);
-    Assert.assertEquals(4, taskMetadataInfos.size());
+    Assertions.assertEquals(4, taskMetadataInfos.size());
     verifyTaskInfoToMetadataInfo(completedUnaltered, taskMetadataInfos, false);
     verifyTaskInfoToMetadataInfo(completedAltered, taskMetadataInfos, false);
     verifyTaskInfoToMetadataInfo(activeUnaltered, taskMetadataInfos, false);
@@ -421,7 +425,7 @@ public class SQLMetadataStorageActionHandlerTest
 
     // New columns based fetch before migration is complete. type and payload are null when altered = false
     taskMetadataInfos = handler.getTaskStatusList(taskLookups, null, false);
-    Assert.assertEquals(4, taskMetadataInfos.size());
+    Assertions.assertEquals(4, taskMetadataInfos.size());
     verifyTaskInfoToMetadataInfo(completedUnaltered, taskMetadataInfos, true);
     verifyTaskInfoToMetadataInfo(completedAltered, taskMetadataInfos, false);
     verifyTaskInfoToMetadataInfo(activeUnaltered, taskMetadataInfos, true);
@@ -432,7 +436,7 @@ public class SQLMetadataStorageActionHandlerTest
 
     // Payload based fetch. task type and groupid will still be populated in tasks tab
     taskMetadataInfos = handler.getTaskStatusList(taskLookups, null, true);
-    Assert.assertEquals(4, taskMetadataInfos.size());
+    Assertions.assertEquals(4, taskMetadataInfos.size());
     verifyTaskInfoToMetadataInfo(completedUnaltered, taskMetadataInfos, false);
     verifyTaskInfoToMetadataInfo(completedAltered, taskMetadataInfos, false);
     verifyTaskInfoToMetadataInfo(activeUnaltered, taskMetadataInfos, false);
@@ -440,7 +444,7 @@ public class SQLMetadataStorageActionHandlerTest
 
     // New columns based fetch after migration is complete. All data must be populated in the tasks table
     taskMetadataInfos = handler.getTaskStatusList(taskLookups, null, false);
-    Assert.assertEquals(4, taskMetadataInfos.size());
+    Assertions.assertEquals(4, taskMetadataInfos.size());
     verifyTaskInfoToMetadataInfo(completedUnaltered, taskMetadataInfos, false);
     verifyTaskInfoToMetadataInfo(completedAltered, taskMetadataInfos, false);
     verifyTaskInfoToMetadataInfo(activeUnaltered, taskMetadataInfos, false);
@@ -530,33 +534,33 @@ public class SQLMetadataStorageActionHandlerTest
       }
       return;
     }
-    Assert.fail();
+    Assertions.fail();
   }
 
   private void verifyTaskInfoToMetadataInfo(TaskInfo taskInfo,
                                             TaskIdStatus taskMetadataInfo,
                                             boolean nullNewColumns)
   {
-    Assert.assertEquals(taskInfo.getId(), taskMetadataInfo.getTaskIdentifier().getId());
-    Assert.assertEquals(taskInfo.getCreatedTime(), taskMetadataInfo.getCreatedTime());
-    Assert.assertEquals(taskInfo.getDataSource(), taskMetadataInfo.getDataSource());
+    Assertions.assertEquals(taskInfo.getId(), taskMetadataInfo.getTaskIdentifier().getId());
+    Assertions.assertEquals(taskInfo.getCreatedTime(), taskMetadataInfo.getCreatedTime());
+    Assertions.assertEquals(taskInfo.getDataSource(), taskMetadataInfo.getDataSource());
 
     verifyTaskStatus(taskInfo.getStatus(), taskMetadataInfo.getStatus());
 
     Task task = taskInfo.getTask();
     TaskIdentifier taskIdentifier = taskMetadataInfo.getTaskIdentifier();
-    Assert.assertEquals(task.getId(), taskIdentifier.getId());
+    Assertions.assertEquals(task.getId(), taskIdentifier.getId());
     if (nullNewColumns) {
-      Assert.assertNull(taskIdentifier.getGroupId());
-      Assert.assertNull(taskIdentifier.getType());
+      Assertions.assertNull(taskIdentifier.getGroupId());
+      Assertions.assertNull(taskIdentifier.getType());
     } else {
-      Assert.assertEquals(task.getGroupId(), taskIdentifier.getGroupId());
-      Assert.assertEquals(task.getType(), taskIdentifier.getType());
+      Assertions.assertEquals(task.getGroupId(), taskIdentifier.getGroupId());
+      Assertions.assertEquals(task.getType(), taskIdentifier.getType());
     }
   }
 
   private void verifyTaskStatus(TaskStatus expected, TaskStatus actual)
   {
-    Assert.assertEquals(expected, actual);
+    Assertions.assertEquals(expected, actual);
   }
 }
diff --git a/multi-stage-query/src/test/java/org/apache/druid/msq/dart/worker/DartWorkerRunnerTest.java b/multi-stage-query/src/test/java/org/apache/druid/msq/dart/worker/DartWorkerRunnerTest.java
index 8719661c285..16bfd26e2dc 100644
--- a/multi-stage-query/src/test/java/org/apache/druid/msq/dart/worker/DartWorkerRunnerTest.java
+++ b/multi-stage-query/src/test/java/org/apache/druid/msq/dart/worker/DartWorkerRunnerTest.java
@@ -78,7 +78,7 @@ public class DartWorkerRunnerTest
   private AutoCloseable mockCloser;
 
   @RegisterExtension
-  public final TemporaryFolderExtension temporaryFolder = new TemporaryFolderExtension();
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   @Mock
   private DartWorkerContextFactory workerFactory;
diff --git a/multi-stage-query/src/test/java/org/apache/druid/msq/indexing/report/MSQTaskReportTest.java b/multi-stage-query/src/test/java/org/apache/druid/msq/indexing/report/MSQTaskReportTest.java
index b83fbdb75c2..77b27f5ba4d 100644
--- a/multi-stage-query/src/test/java/org/apache/druid/msq/indexing/report/MSQTaskReportTest.java
+++ b/multi-stage-query/src/test/java/org/apache/druid/msq/indexing/report/MSQTaskReportTest.java
@@ -80,7 +80,7 @@ public class MSQTaskReportTest
           .build();
 
   @RegisterExtension
-  public final TemporaryFolderExtension temporaryFolder = new TemporaryFolderExtension();
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   @Test
   public void testSerdeResultsReport() throws Exception
diff --git a/multi-stage-query/src/test/java/org/apache/druid/msq/input/RegularLoadableSegmentTest.java b/multi-stage-query/src/test/java/org/apache/druid/msq/input/RegularLoadableSegmentTest.java
index 524e6a191a5..e9c595d9d10 100644
--- a/multi-stage-query/src/test/java/org/apache/druid/msq/input/RegularLoadableSegmentTest.java
+++ b/multi-stage-query/src/test/java/org/apache/druid/msq/input/RegularLoadableSegmentTest.java
@@ -96,7 +96,7 @@ class RegularLoadableSegmentTest extends InitializedNullHandlingTest
   private static File SEGMENT_ZIP_FILE;
 
   @RegisterExtension
-  public final TemporaryFolderExtension temporaryFolder = new TemporaryFolderExtension();
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   private Path tempDir;
 
diff --git a/multi-stage-query/src/test/java/org/apache/druid/msq/querykit/BroadcastJoinSegmentMapFnProcessorTest.java b/multi-stage-query/src/test/java/org/apache/druid/msq/querykit/BroadcastJoinSegmentMapFnProcessorTest.java
index f8a18757cc3..397fdfb9954 100644
--- a/multi-stage-query/src/test/java/org/apache/druid/msq/querykit/BroadcastJoinSegmentMapFnProcessorTest.java
+++ b/multi-stage-query/src/test/java/org/apache/druid/msq/querykit/BroadcastJoinSegmentMapFnProcessorTest.java
@@ -71,7 +71,7 @@ import java.util.stream.Collectors;
 public class BroadcastJoinSegmentMapFnProcessorTest extends InitializedNullHandlingTest
 {
   @RegisterExtension
-  public final TemporaryFolderExtension temporaryFolder = new TemporaryFolderExtension();
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   private CursorFactory cursorFactory;
   private File testDataFile1;
diff --git a/multi-stage-query/src/test/java/org/apache/druid/msq/querykit/common/SortMergeJoinFrameProcessorTest.java b/multi-stage-query/src/test/java/org/apache/druid/msq/querykit/common/SortMergeJoinFrameProcessorTest.java
index 9d983d6be88..69d87eec176 100644
--- a/multi-stage-query/src/test/java/org/apache/druid/msq/querykit/common/SortMergeJoinFrameProcessorTest.java
+++ b/multi-stage-query/src/test/java/org/apache/druid/msq/querykit/common/SortMergeJoinFrameProcessorTest.java
@@ -76,7 +76,7 @@ public class SortMergeJoinFrameProcessorTest extends FrameProcessorTestBase
   private final int rowsPerOutputFrame;
 
   @RegisterExtension
-  public final TemporaryFolderExtension temporaryFolder = new TemporaryFolderExtension();
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   public SortMergeJoinFrameProcessorTest(int rowsPerInputFrame, int rowsPerOutputFrame)
   {
diff --git a/multi-stage-query/src/test/java/org/apache/druid/msq/shuffle/output/ChannelStageOutputReaderTest.java b/multi-stage-query/src/test/java/org/apache/druid/msq/shuffle/output/ChannelStageOutputReaderTest.java
index 8a20a182922..d556f185535 100644
--- a/multi-stage-query/src/test/java/org/apache/druid/msq/shuffle/output/ChannelStageOutputReaderTest.java
+++ b/multi-stage-query/src/test/java/org/apache/druid/msq/shuffle/output/ChannelStageOutputReaderTest.java
@@ -73,7 +73,7 @@ public class ChannelStageOutputReaderTest extends InitializedNullHandlingTest
     );
 
     @RegisterExtension
-    public final TemporaryFolderExtension temporaryFolder = new TemporaryFolderExtension();
+    public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
     private BlockingQueueFrameChannel channel;
     private ChannelStageOutputReader channelReader;
@@ -280,7 +280,7 @@ public class ChannelStageOutputReaderTest extends InitializedNullHandlingTest
     private final ChannelStageOutputReader reader = new ChannelStageOutputReader(channel.readable(), FrameTestUtil.WT_CONTEXT_LEGACY);
 
     @RegisterExtension
-    public final TemporaryFolderExtension temporaryFolder = new TemporaryFolderExtension();
+    public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
     private FrameReader frameReader;
     private List<Frame> frameList;
diff --git a/multi-stage-query/src/test/java/org/apache/druid/msq/shuffle/output/NilStageOutputReaderTest.java b/multi-stage-query/src/test/java/org/apache/druid/msq/shuffle/output/NilStageOutputReaderTest.java
index 6f57fb192db..c700d631fac 100644
--- a/multi-stage-query/src/test/java/org/apache/druid/msq/shuffle/output/NilStageOutputReaderTest.java
+++ b/multi-stage-query/src/test/java/org/apache/druid/msq/shuffle/output/NilStageOutputReaderTest.java
@@ -42,7 +42,7 @@ import java.util.concurrent.ExecutionException;
 public class NilStageOutputReaderTest extends InitializedNullHandlingTest
 {
   @RegisterExtension
-  public final TemporaryFolderExtension temporaryFolder = new TemporaryFolderExtension();
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   private final NilStageOutputReader reader = NilStageOutputReader.INSTANCE;
 
diff --git a/pom.xml b/pom.xml
index d477e829b5b..1b860edbe6b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1279,12 +1279,6 @@
                 <version>5.6.0</version>
                 <scope>test</scope>
             </dependency>
-            <dependency>
-                <groupId>junit</groupId>
-                <artifactId>junit</artifactId>
-                <version>4.13.2</version>
-                <scope>test</scope>
-            </dependency>
             <dependency>
                 <groupId>net.hydromatic</groupId>
                 <artifactId>quidem</artifactId>
@@ -1317,12 +1311,6 @@
                 <artifactId>slf4j-simple</artifactId>
                 <version>${slf4j.version}</version>
             </dependency>
-            <dependency>
-                <groupId>com.carrotsearch</groupId>
-                <artifactId>junit-benchmarks</artifactId>
-                <version>0.7.2</version>
-                <scope>test</scope>
-            </dependency>
             <dependency>
                 <groupId>com.google.caliper</groupId>
                 <artifactId>caliper</artifactId>
@@ -1465,12 +1453,6 @@
                 <version>0.10.2</version>
                 <scope>test</scope>
             </dependency>
-            <dependency>
-                <groupId>pl.pragmatists</groupId>
-                <artifactId>JUnitParams</artifactId>
-                <version>1.1.1</version>
-                <scope>test</scope>
-            </dependency>
             <dependency>
                 <groupId>com.google.inject.extensions</groupId>
                 <artifactId>guice-testlib</artifactId>
@@ -1495,12 +1477,6 @@
               <version>3.5</version>
               <scope>test</scope>
             </dependency>
-            <dependency>
-              <groupId>com.github.stefanbirkner</groupId>
-              <artifactId>system-rules</artifactId>
-              <version>1.19.0</version>
-              <scope>test</scope>
-            </dependency>
           <dependency>
             <groupId>io.timeandspace</groupId>
             <artifactId>cron-scheduler</artifactId>
@@ -1614,11 +1590,6 @@
                     </exclusions>
                 </configuration>
                 <dependencies>
-                    <dependency>
-                        <groupId>org.openrewrite.recipe</groupId>
-                        <artifactId>rewrite-testing-frameworks</artifactId>
-                        <version>2.20.0</version>
-                    </dependency>
                     <dependency>
                         <groupId>org.openrewrite.recipe</groupId>
                         <artifactId>rewrite-apache</artifactId>
diff --git a/processing/pom.xml b/processing/pom.xml
index 6e5240ff7cc..2d43137e955 100644
--- a/processing/pom.xml
+++ b/processing/pom.xml
@@ -347,11 +347,6 @@
     </dependency>
 
     <!-- Tests -->
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
     <dependency>
       <groupId>org.junit.jupiter</groupId>
       <artifactId>junit-jupiter-api</artifactId>
@@ -368,16 +363,6 @@
       <artifactId>junit-jupiter-engine</artifactId>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>org.junit.vintage</groupId>
-      <artifactId>junit-vintage-engine</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>com.carrotsearch</groupId>
-      <artifactId>junit-benchmarks</artifactId>
-      <scope>test</scope>
-    </dependency>
     <dependency>
       <groupId>org.easymock</groupId>
       <artifactId>easymock</artifactId>
@@ -410,15 +395,16 @@
       <artifactId>reflections</artifactId>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>pl.pragmatists</groupId>
-      <artifactId>JUnitParams</artifactId>
-      <scope>test</scope>
-    </dependency>
     <dependency>
       <groupId>com.google.guava</groupId>
       <artifactId>guava-testlib</artifactId>
       <scope>test</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>junit</groupId>
+          <artifactId>junit</artifactId>
+        </exclusion>
+      </exclusions>
     </dependency>
     <dependency>
       <groupId>org.hamcrest</groupId>
@@ -468,21 +454,11 @@
       <artifactId>postgresql</artifactId>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>com.github.stefanbirkner</groupId>
-      <artifactId>system-rules</artifactId>
-      <scope>test</scope>
-    </dependency>
     <dependency>
       <groupId>org.junit.jupiter</groupId>
       <artifactId>junit-jupiter-params</artifactId>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>org.junit.jupiter</groupId>
-      <artifactId>junit-jupiter-migrationsupport</artifactId>
-      <scope>test</scope>
-    </dependency>
   </dependencies>
 
   <build>
diff --git a/processing/src/test/java/org/apache/druid/common/guava/FutureUtilsTest.java b/processing/src/test/java/org/apache/druid/common/guava/FutureUtilsTest.java
index f54c7409a9e..009b1f8c490 100644
--- a/processing/src/test/java/org/apache/druid/common/guava/FutureUtilsTest.java
+++ b/processing/src/test/java/org/apache/druid/common/guava/FutureUtilsTest.java
@@ -27,10 +27,6 @@ import org.apache.druid.java.util.common.Either;
 import org.apache.druid.java.util.common.ISE;
 import org.apache.druid.java.util.common.StringUtils;
 import org.apache.druid.java.util.common.concurrent.Execs;
-import org.hamcrest.CoreMatchers;
-import org.hamcrest.MatcherAssert;
-import org.junit.internal.matchers.ThrowableCauseMatcher;
-import org.junit.internal.matchers.ThrowableMessageMatcher;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
@@ -82,8 +78,8 @@ public class FutureUtilsTest
         () -> FutureUtils.get(Futures.immediateFailedFuture(new ISE("oh no")), true)
     );
 
-    MatcherAssert.assertThat(e.getCause(), CoreMatchers.instanceOf(IllegalStateException.class));
-    MatcherAssert.assertThat(e.getCause(), ThrowableMessageMatcher.hasMessage(CoreMatchers.containsString("oh no")));
+    Assertions.assertInstanceOf(IllegalStateException.class, e.getCause());
+    Assertions.assertTrue(e.getCause().getMessage().contains("oh no"));
   }
 
   @Test
@@ -114,8 +110,8 @@ public class FutureUtilsTest
     Assertions.assertTrue(neverGoingToResolve.isCancelled());
 
     final Throwable e = exceptionFromOtherThread.get();
-    MatcherAssert.assertThat(e, CoreMatchers.instanceOf(RuntimeException.class));
-    MatcherAssert.assertThat(e.getCause(), CoreMatchers.instanceOf(InterruptedException.class));
+    Assertions.assertInstanceOf(RuntimeException.class, e);
+    Assertions.assertInstanceOf(InterruptedException.class, e.getCause());
   }
 
   @Test
@@ -147,8 +143,8 @@ public class FutureUtilsTest
     Assertions.assertFalse(neverGoingToResolve.isDone());
 
     final Throwable e = exceptionFromOtherThread.get();
-    MatcherAssert.assertThat(e, CoreMatchers.instanceOf(RuntimeException.class));
-    MatcherAssert.assertThat(e.getCause(), CoreMatchers.instanceOf(InterruptedException.class));
+    Assertions.assertInstanceOf(RuntimeException.class, e);
+    Assertions.assertInstanceOf(InterruptedException.class, e.getCause());
   }
 
   @Test
@@ -166,8 +162,8 @@ public class FutureUtilsTest
         () -> FutureUtils.getUnchecked(Futures.immediateFailedFuture(new ISE("oh no")), true)
     );
 
-    MatcherAssert.assertThat(e.getCause(), CoreMatchers.instanceOf(IllegalStateException.class));
-    MatcherAssert.assertThat(e.getCause(), ThrowableMessageMatcher.hasMessage(CoreMatchers.containsString("oh no")));
+    Assertions.assertInstanceOf(IllegalStateException.class, e.getCause());
+    Assertions.assertTrue(e.getCause().getMessage().contains("oh no"));
   }
 
   @Test
@@ -185,8 +181,8 @@ public class FutureUtilsTest
         () -> FutureUtils.getUncheckedImmediately(Futures.immediateFailedFuture(new ISE("oh no")))
     );
 
-    MatcherAssert.assertThat(e.getCause(), CoreMatchers.instanceOf(IllegalStateException.class));
-    MatcherAssert.assertThat(e.getCause(), ThrowableMessageMatcher.hasMessage(CoreMatchers.containsString("oh no")));
+    Assertions.assertInstanceOf(IllegalStateException.class, e.getCause());
+    Assertions.assertTrue(e.getCause().getMessage().contains("oh no"));
   }
 
   @Test
@@ -223,15 +219,8 @@ public class FutureUtilsTest
         future::get
     );
 
-    MatcherAssert.assertThat(
-        e,
-        ThrowableCauseMatcher.hasCause(CoreMatchers.instanceOf(IllegalStateException.class))
-    );
-
-    MatcherAssert.assertThat(
-        e,
-        ThrowableCauseMatcher.hasCause(ThrowableMessageMatcher.hasMessage(CoreMatchers.startsWith("oops")))
-    );
+    final Throwable cause = Assertions.assertInstanceOf(IllegalStateException.class, e.getCause());
+    Assertions.assertTrue(cause.getMessage().startsWith("oops"));
   }
 
   @Test
@@ -258,15 +247,8 @@ public class FutureUtilsTest
         f::get
     );
 
-    MatcherAssert.assertThat(
-        e,
-        ThrowableCauseMatcher.hasCause(CoreMatchers.instanceOf(ISE.class))
-    );
-
-    MatcherAssert.assertThat(
-        e,
-        ThrowableCauseMatcher.hasCause(ThrowableMessageMatcher.hasMessage(CoreMatchers.containsString("error!")))
-    );
+    final Throwable cause = Assertions.assertInstanceOf(ISE.class, e.getCause());
+    Assertions.assertTrue(cause.getMessage().contains("error!"));
   }
 
   @Test
@@ -315,10 +297,7 @@ public class FutureUtilsTest
     Assertions.assertTrue(results.get(1).isError());
     Assertions.assertEquals(Either.value(null), results.get(2));
 
-    MatcherAssert.assertThat(
-        results.get(1).error(),
-        CoreMatchers.instanceOf(CancellationException.class)
-    );
+    Assertions.assertInstanceOf(CancellationException.class, results.get(1).error());
   }
 
   @Test
@@ -384,8 +363,8 @@ public class FutureUtilsTest
     future.setException(new ISE("error!"));
 
     final ExecutionException e = Assertions.assertThrows(ExecutionException.class, futureWithBaggage::get);
-    MatcherAssert.assertThat(e.getCause(), CoreMatchers.instanceOf(IllegalStateException.class));
-    MatcherAssert.assertThat(e.getCause(), ThrowableMessageMatcher.hasMessage(CoreMatchers.equalTo("error!")));
+    Assertions.assertInstanceOf(IllegalStateException.class, e.getCause());
+    Assertions.assertEquals("error!", e.getCause().getMessage());
     Assertions.assertEquals(1, baggageHandled.get());
   }
 }
diff --git a/processing/src/test/java/org/apache/druid/data/input/BytesCountingInputEntityTest.java b/processing/src/test/java/org/apache/druid/data/input/BytesCountingInputEntityTest.java
index 63da482503d..b87639b502f 100644
--- a/processing/src/test/java/org/apache/druid/data/input/BytesCountingInputEntityTest.java
+++ b/processing/src/test/java/org/apache/druid/data/input/BytesCountingInputEntityTest.java
@@ -22,24 +22,23 @@ package org.apache.druid.data.input;
 import org.apache.druid.data.input.impl.ByteEntity;
 import org.apache.druid.data.input.impl.FileEntity;
 import org.apache.druid.data.input.impl.InputStatsImpl;
-import org.apache.druid.java.util.common.FileUtils;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStreamWriter;
 import java.nio.charset.StandardCharsets;
-import java.nio.file.Path;
 import java.util.Arrays;
 
 public class BytesCountingInputEntityTest
 {
-  @TempDir
-  private Path tempDir;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   private InputStats inputStats;
 
@@ -53,11 +52,11 @@ public class BytesCountingInputEntityTest
   public void testFetch() throws IOException
   {
     final int fileSize = 200;
-    final File sourceFile = tempDir.resolve("testWithFileEntity").toFile();
+    final File sourceFile = temporaryFolder.newFile("testWithFileEntity");
     writeBytesToFile(sourceFile, fileSize);
 
     final BytesCountingInputEntity inputEntity = new BytesCountingInputEntity(new FileEntity(sourceFile), inputStats);
-    inputEntity.fetch(FileUtils.createTempDirInLocation(tempDir, "fetch1"), new byte[50]);
+    inputEntity.fetch(temporaryFolder.newFolder(), new byte[50]);
     Assertions.assertEquals(fileSize, inputStats.getProcessedBytes());
   }
 
@@ -65,7 +64,7 @@ public class BytesCountingInputEntityTest
   public void testFetchFromPartiallyReadFile() throws IOException
   {
     final int fileSize = 200;
-    final File sourceFile = tempDir.resolve("testWithFileEntity2").toFile();
+    final File sourceFile = temporaryFolder.newFile("testWithFileEntity2");
     writeBytesToFile(sourceFile, fileSize);
 
     final int bufferSize = 50;
@@ -77,14 +76,14 @@ public class BytesCountingInputEntityTest
     Assertions.assertEquals(bufferSize, inputStats.getProcessedBytes());
 
     // Read the whole file again
-    inputEntity.fetch(FileUtils.createTempDirInLocation(tempDir, "fetch2"), intermediateBuffer);
+    inputEntity.fetch(temporaryFolder.newFolder(), intermediateBuffer);
     Assertions.assertEquals(fileSize + bufferSize, inputStats.getProcessedBytes());
   }
 
   @Test
   public void testFetchFromDirectory() throws IOException
   {
-    final File sourceDir = FileUtils.createTempDirInLocation(tempDir, "testWithDirectory");
+    final File sourceDir = temporaryFolder.newFolder("testWithDirectory");
 
     final int fileSize1 = 100;
     final File sourceFile1 = new File(sourceDir, "file1");
@@ -95,7 +94,7 @@ public class BytesCountingInputEntityTest
     writeBytesToFile(sourceFile2, fileSize2);
 
     final BytesCountingInputEntity inputEntity = new BytesCountingInputEntity(new FileEntity(sourceDir), inputStats);
-    inputEntity.fetch(FileUtils.createTempDirInLocation(tempDir, "fetch3"), new byte[1000]);
+    inputEntity.fetch(temporaryFolder.newFolder(), new byte[1000]);
     Assertions.assertEquals(fileSize1 + fileSize2, inputStats.getProcessedBytes());
   }
 
diff --git a/processing/src/test/java/org/apache/druid/data/input/impl/CloudObjectInputSourceTest.java b/processing/src/test/java/org/apache/druid/data/input/impl/CloudObjectInputSourceTest.java
index a0ac99f1446..68f6bcce5de 100644
--- a/processing/src/test/java/org/apache/druid/data/input/impl/CloudObjectInputSourceTest.java
+++ b/processing/src/test/java/org/apache/druid/data/input/impl/CloudObjectInputSourceTest.java
@@ -28,9 +28,10 @@ import org.apache.druid.data.input.MaxSizeSplitHintSpec;
 import org.apache.druid.data.input.impl.systemfield.SystemField;
 import org.apache.druid.data.input.impl.systemfield.SystemFields;
 import org.apache.druid.java.util.common.parsers.JSONPathSpec;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.mockito.ArgumentMatchers;
 import org.mockito.Mockito;
 
@@ -53,6 +54,9 @@ import java.util.stream.Stream;
 
 public class CloudObjectInputSourceTest
 {
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
+
   private static final String SCHEME = "s3";
 
   private static final List<URI> URIS = Collections.singletonList(
@@ -317,7 +321,7 @@ public class CloudObjectInputSourceTest
   }
 
   @Test
-  public void test_asFilePointers_populatorFetchesContent(@TempDir File tempDir) throws IOException
+  public void test_asFilePointers_populatorFetchesContent() throws IOException
   {
     final byte[] content = "hello,world\n1,2\n".getBytes(StandardCharsets.UTF_8);
 
@@ -335,7 +339,7 @@ public class CloudObjectInputSourceTest
     final List<InputFilePointer> pointers = inputSource.asFilePointers();
     Assertions.assertEquals(1, pointers.size());
 
-    final File dstFile = new File(tempDir, "fetched.csv");
+    final File dstFile = new File(temporaryFolder.getRoot(), "fetched.csv");
     pointers.get(0).populator().populate(dstFile);
 
     Assertions.assertArrayEquals(content, Files.readAllBytes(dstFile.toPath()));
diff --git a/processing/src/test/java/org/apache/druid/data/input/impl/CsvInputFormatTest.java b/processing/src/test/java/org/apache/druid/data/input/impl/CsvInputFormatTest.java
index b7d7f983b2a..dce2b9d5403 100644
--- a/processing/src/test/java/org/apache/druid/data/input/impl/CsvInputFormatTest.java
+++ b/processing/src/test/java/org/apache/druid/data/input/impl/CsvInputFormatTest.java
@@ -24,9 +24,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.druid.data.input.InputFormat;
 import org.apache.druid.testing.InitializedNullHandlingTest;
 import org.apache.druid.utils.CompressionUtils;
-import org.hamcrest.CoreMatchers;
-import org.hamcrest.MatcherAssert;
-import org.junit.internal.matchers.ThrowableMessageMatcher;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
 
@@ -78,13 +75,11 @@ public class CsvInputFormatTest extends InitializedNullHandlingTest
             InputFormat.class
         )
     );
-    MatcherAssert.assertThat(
-        e,
-        ThrowableMessageMatcher.hasMessage(CoreMatchers.startsWith(
-            "Cannot construct instance of `org.apache.druid.data.input.impl.CsvInputFormat`, problem: "
-            + "If [columns] is not set, the first row of your data must have your header and "
-            + "[findColumnsFromHeader] must be set to true."))
-    );
+    Assertions.assertTrue(e.getMessage().startsWith(
+        "Cannot construct instance of `org.apache.druid.data.input.impl.CsvInputFormat`, problem: "
+        + "If [columns] is not set, the first row of your data must have your header and "
+        + "[findColumnsFromHeader] must be set to true."
+    ));
   }
 
   @Test
@@ -98,12 +93,10 @@ public class CsvInputFormatTest extends InitializedNullHandlingTest
             InputFormat.class
         )
     );
-    MatcherAssert.assertThat(
-        e,
-        ThrowableMessageMatcher.hasMessage(CoreMatchers.startsWith(
-            "Cannot construct instance of `org.apache.druid.data.input.impl.CsvInputFormat`, problem: "
-            + "Cannot accept both [findColumnsFromHeader] and [hasHeaderRow]"))
-    );
+    Assertions.assertTrue(e.getMessage().startsWith(
+        "Cannot construct instance of `org.apache.druid.data.input.impl.CsvInputFormat`, problem: "
+        + "Cannot accept both [findColumnsFromHeader] and [hasHeaderRow]"
+    ));
   }
 
   @Test
@@ -114,12 +107,10 @@ public class CsvInputFormatTest extends InitializedNullHandlingTest
         JsonProcessingException.class,
         () -> mapper.readValue("{\"type\":\"csv\"}", InputFormat.class)
     );
-    MatcherAssert.assertThat(
-        e,
-        ThrowableMessageMatcher.hasMessage(CoreMatchers.startsWith(
-            "Cannot construct instance of `org.apache.druid.data.input.impl.CsvInputFormat`, problem: "
-            + "Either [columns] or [findColumnsFromHeader] must be set"))
-    );
+    Assertions.assertTrue(e.getMessage().startsWith(
+        "Cannot construct instance of `org.apache.druid.data.input.impl.CsvInputFormat`, problem: "
+        + "Either [columns] or [findColumnsFromHeader] must be set"
+    ));
   }
 
   @Test
diff --git a/processing/src/test/java/org/apache/druid/data/input/impl/FileEntityTest.java b/processing/src/test/java/org/apache/druid/data/input/impl/FileEntityTest.java
index 315c942bc45..232bb5d844c 100644
--- a/processing/src/test/java/org/apache/druid/data/input/impl/FileEntityTest.java
+++ b/processing/src/test/java/org/apache/druid/data/input/impl/FileEntityTest.java
@@ -23,10 +23,11 @@ import org.apache.commons.io.IOUtils;
 import org.apache.druid.data.input.InputEntity;
 import org.apache.druid.data.input.InputEntity.CleanableFile;
 import org.apache.druid.java.util.common.StringUtils;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.apache.druid.utils.CompressionUtils;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.File;
 import java.io.IOException;
@@ -38,8 +39,8 @@ public class FileEntityTest
 {
   private static final String CONTENT = "the quick brown fox\n";
 
-  @TempDir
-  File tempDir;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   @Test
   public void test_openRaw_returnsRawBytesWithoutDecompressing() throws IOException
@@ -98,7 +99,7 @@ public class FileEntityTest
 
   private File writeFile(final String name, final String content) throws IOException
   {
-    final File file = new File(tempDir, name);
+    final File file = temporaryFolder.newFile(name);
     Files.write(file.toPath(), StringUtils.toUtf8(content));
     return file;
   }
@@ -106,16 +107,14 @@ public class FileEntityTest
   private File gzipFile(final String name, final String content) throws IOException
   {
     final File source = writeFile("source-for-" + name, content);
-    final File gzFile = new File(tempDir, name);
+    final File gzFile = temporaryFolder.newFile(name);
     CompressionUtils.gzip(source, gzFile);
     return gzFile;
   }
 
   private File makeDir(final String name) throws IOException
   {
-    final File dir = new File(tempDir, name);
-    Files.createDirectories(dir.toPath());
-    return dir;
+    return temporaryFolder.newFolder(name);
   }
 
   private static byte[] fetchBuffer()
diff --git a/processing/src/test/java/org/apache/druid/data/input/impl/InputEntityIteratingReaderTest.java b/processing/src/test/java/org/apache/druid/data/input/impl/InputEntityIteratingReaderTest.java
index 1710384dadc..f24e8058bc3 100644
--- a/processing/src/test/java/org/apache/druid/data/input/impl/InputEntityIteratingReaderTest.java
+++ b/processing/src/test/java/org/apache/druid/data/input/impl/InputEntityIteratingReaderTest.java
@@ -34,9 +34,10 @@ import org.apache.druid.java.util.common.DateTimes;
 import org.apache.druid.java.util.common.StringUtils;
 import org.apache.druid.java.util.common.parsers.CloseableIterator;
 import org.apache.druid.testing.InitializedNullHandlingTest;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.File;
 import java.io.IOException;
@@ -51,8 +52,8 @@ import java.util.List;
 
 public class InputEntityIteratingReaderTest extends InitializedNullHandlingTest
 {
-  @TempDir
-  public File temporaryFolder;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   @Test
   public void test() throws IOException
@@ -61,7 +62,7 @@ public class InputEntityIteratingReaderTest extends InitializedNullHandlingTest
     final List<File> files = new ArrayList<>();
     long totalFileSize = 0;
     for (int i = 0; i < numFiles; i++) {
-      final File file = new File(temporaryFolder, "test_" + i);
+      final File file = temporaryFolder.newFile("test_" + i);
       files.add(file);
       try (Writer writer = Files.newBufferedWriter(file.toPath(), StandardCharsets.UTF_8)) {
         writer.write(StringUtils.format("%d,%s,%d\n", 20190101 + i, "name_" + i, i));
@@ -90,7 +91,7 @@ public class InputEntityIteratingReaderTest extends InitializedNullHandlingTest
             files.stream().flatMap(file -> ImmutableList.of(new FileEntity(file)).stream()).iterator()
         ),
         SystemFieldDecoratorFactory.NONE,
-        temporaryFolder
+        temporaryFolder.getRoot()
     );
 
     final InputStats inputStats = new InputStatsImpl();
@@ -120,7 +121,7 @@ public class InputEntityIteratingReaderTest extends InitializedNullHandlingTest
     final int numFiles = 5;
     final List<File> files = new ArrayList<>();
     for (int i = 0; i < numFiles; i++) {
-      final File file = new File(temporaryFolder, "test_" + i);
+      final File file = temporaryFolder.newFile("test_" + i);
       files.add(file);
       try (Writer writer = Files.newBufferedWriter(file.toPath(), StandardCharsets.UTF_8)) {
         writer.write(StringUtils.format("%d,%s,%d\n", 20190101 + i, "name_" + i, i));
@@ -129,7 +130,7 @@ public class InputEntityIteratingReaderTest extends InitializedNullHandlingTest
     }
 
     LocalInputSource inputSource = new LocalInputSource(
-        temporaryFolder,
+        temporaryFolder.getRoot(),
         "test_*",
         null,
         new SystemFields(EnumSet.of(SystemField.URI, SystemField.PATH)));
@@ -159,7 +160,7 @@ public class InputEntityIteratingReaderTest extends InitializedNullHandlingTest
             files.stream().flatMap(file -> ImmutableList.of(new FileEntity(file)).stream()).iterator()
         ),
         SystemFieldDecoratorFactory.fromInputSource(inputSource),
-        temporaryFolder
+        temporaryFolder.getRoot()
     );
 
     try (CloseableIterator<InputRowListPlusRawValues> iterator = reader.sample()) {
@@ -219,7 +220,7 @@ public class InputEntityIteratingReaderTest extends InitializedNullHandlingTest
             ).iterator()
         ),
         SystemFieldDecoratorFactory.NONE,
-        temporaryFolder
+        temporaryFolder.getRoot()
     );
 
     try (CloseableIterator<InputRow> readIterator = inputReader.read()) {
diff --git a/processing/src/test/java/org/apache/druid/data/input/impl/LocalInputSourceTest.java b/processing/src/test/java/org/apache/druid/data/input/impl/LocalInputSourceTest.java
index b1d1256e5b8..4aff4cf9221 100644
--- a/processing/src/test/java/org/apache/druid/data/input/impl/LocalInputSourceTest.java
+++ b/processing/src/test/java/org/apache/druid/data/input/impl/LocalInputSourceTest.java
@@ -29,11 +29,12 @@ import org.apache.druid.data.input.MaxSizeSplitHintSpec;
 import org.apache.druid.data.input.impl.systemfield.SystemField;
 import org.apache.druid.data.input.impl.systemfield.SystemFields;
 import org.apache.druid.java.util.common.HumanReadableBytes;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.apache.druid.utils.Streams;
 import org.easymock.EasyMock;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.File;
 import java.io.IOException;
@@ -52,8 +53,8 @@ import java.util.stream.Collectors;
 public class LocalInputSourceTest
 {
 
-  @TempDir
-  public File temporaryFolder;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   @Test
   public void testSerdeAbsoluteBaseDir() throws IOException
@@ -180,7 +181,7 @@ public class LocalInputSourceTest
   @Test
   public void testGetFileIteratorWithBothBaseDirAndDuplicateFilesIteratingFilesOnlyOnce() throws IOException
   {
-    File baseDir = temporaryFolder;
+    File baseDir = temporaryFolder.getRoot();
     List<File> filesInBaseDir = new ArrayList<>();
     for (int i = 0; i < 10; i++) {
       final File file = File.createTempFile("local-input-source", ".data", baseDir);
@@ -208,7 +209,7 @@ public class LocalInputSourceTest
   @Test
   public void testGetFileIteratorWithOnlyBaseDirIteratingAllFiles() throws IOException
   {
-    File baseDir = temporaryFolder;
+    File baseDir = temporaryFolder.getRoot();
     Set<File> filesInBaseDir = new HashSet<>();
     for (int i = 0; i < 10; i++) {
       final File file = File.createTempFile("local-input-source", ".data", baseDir);
@@ -225,7 +226,7 @@ public class LocalInputSourceTest
   @Test
   public void testGetFileIteratorWithOnlyFilesIteratingAllFiles() throws IOException
   {
-    File baseDir = temporaryFolder;
+    File baseDir = temporaryFolder.getRoot();
     List<File> filesInBaseDir = new ArrayList<>();
     for (int i = 0; i < 10; i++) {
       final File file = File.createTempFile("local-input-source", ".data", baseDir);
diff --git a/processing/src/test/java/org/apache/druid/data/input/impl/RetryingInputStreamTest.java b/processing/src/test/java/org/apache/druid/data/input/impl/RetryingInputStreamTest.java
index 52decf71376..f21a2e95d9d 100644
--- a/processing/src/test/java/org/apache/druid/data/input/impl/RetryingInputStreamTest.java
+++ b/processing/src/test/java/org/apache/druid/data/input/impl/RetryingInputStreamTest.java
@@ -23,13 +23,14 @@ import com.google.common.base.Preconditions;
 import com.google.common.primitives.Ints;
 import org.apache.commons.io.FileUtils;
 import org.apache.druid.data.input.impl.prefetch.ObjectOpenFunction;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.hamcrest.CoreMatchers;
 import org.hamcrest.MatcherAssert;
 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 org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.mockito.invocation.InvocationOnMock;
 import org.mockito.stubbing.Answer;
 
@@ -56,8 +57,8 @@ import static org.mockito.Mockito.verify;
 public class RetryingInputStreamTest
 {
   private static final int MAX_RETRY = 5;
-  @TempDir
-  public File temporaryFolder;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
   private File testFile;
 
   private int readBytesBeforeExceptions = 0;
@@ -84,7 +85,7 @@ public class RetryingInputStreamTest
   @BeforeEach
   public void setup() throws IOException
   {
-    testFile = File.createTempFile("retrying", null, temporaryFolder);
+    testFile = temporaryFolder.newFile();
 
     try (FileOutputStream fis = new FileOutputStream(testFile);
          GZIPOutputStream gis = new GZIPOutputStream(fis);
diff --git a/processing/src/test/java/org/apache/druid/data/input/impl/RowsTest.java b/processing/src/test/java/org/apache/druid/data/input/impl/RowsTest.java
index b18f4e162c1..c8e1a4f897e 100644
--- a/processing/src/test/java/org/apache/druid/data/input/impl/RowsTest.java
+++ b/processing/src/test/java/org/apache/druid/data/input/impl/RowsTest.java
@@ -28,9 +28,6 @@ import org.apache.druid.java.util.common.StringUtils;
 import org.apache.druid.java.util.common.parsers.ParseException;
 import org.apache.druid.segment.column.ValueType;
 import org.apache.druid.testing.InitializedNullHandlingTest;
-import org.hamcrest.CoreMatchers;
-import org.hamcrest.MatcherAssert;
-import org.junit.internal.matchers.ThrowableMessageMatcher;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
@@ -127,10 +124,7 @@ public class RowsTest extends InitializedNullHandlingTest
           o + " (throw)"
       );
 
-      MatcherAssert.assertThat(
-          e,
-          ThrowableMessageMatcher.hasMessage(CoreMatchers.containsString("for field[" + FIELD_NAME + "]"))
-      );
+      Assertions.assertTrue(e.getMessage().contains("for field[" + FIELD_NAME + "]"));
     }
   }
 
@@ -158,10 +152,7 @@ public class RowsTest extends InitializedNullHandlingTest
           o + " (throw)"
       );
 
-      MatcherAssert.assertThat(
-          e,
-          ThrowableMessageMatcher.hasMessage(CoreMatchers.containsString("for field[" + FIELD_NAME + "]"))
-      );
+      Assertions.assertTrue(e.getMessage().contains("for field[" + FIELD_NAME + "]"));
     }
   }
 
@@ -189,10 +180,7 @@ public class RowsTest extends InitializedNullHandlingTest
           o + " (throw)"
       );
 
-      MatcherAssert.assertThat(
-          e,
-          ThrowableMessageMatcher.hasMessage(CoreMatchers.containsString("for field[" + FIELD_NAME + "]"))
-      );
+      Assertions.assertTrue(e.getMessage().contains("for field[" + FIELD_NAME + "]"));
     }
   }
 
@@ -220,10 +208,7 @@ public class RowsTest extends InitializedNullHandlingTest
           o + " (throw)"
       );
 
-      MatcherAssert.assertThat(
-          e,
-          ThrowableMessageMatcher.hasMessage(CoreMatchers.containsString("for field[" + FIELD_NAME + "]"))
-      );
+      Assertions.assertTrue(e.getMessage().contains("for field[" + FIELD_NAME + "]"));
     }
   }
 
diff --git a/processing/src/test/java/org/apache/druid/error/ExceptionMatcher.java b/processing/src/test/java/org/apache/druid/error/ExceptionMatcher.java
index 5bc16c47f27..7c463388927 100644
--- a/processing/src/test/java/org/apache/druid/error/ExceptionMatcher.java
+++ b/processing/src/test/java/org/apache/druid/error/ExceptionMatcher.java
@@ -20,21 +20,16 @@
 package org.apache.druid.error;
 
 import com.google.common.base.Throwables;
-import org.apache.druid.matchers.DruidMatchers;
-import org.hamcrest.Description;
-import org.hamcrest.DiagnosingMatcher;
-import org.hamcrest.Matcher;
-import org.hamcrest.MatcherAssert;
-import org.hamcrest.Matchers;
-import org.hamcrest.core.AllOf;
+import org.junit.jupiter.api.Assertions;
 
 import java.util.ArrayList;
+import java.util.List;
+import java.util.function.Consumer;
 
 /**
- * A matcher for validating exceptions in unit tests, providing a fluent API for constructing matchers to allow
- * matching of {@link Throwable} objects, such as verifying exception type, message content, and cause.
+ * A JUnit 5 assertion helper for validating exceptions by type, message, and cause.
  */
-public class ExceptionMatcher extends DiagnosingMatcher<Throwable>
+public class ExceptionMatcher
 {
 
   public static ExceptionMatcher of(Class<? extends Throwable> clazz)
@@ -42,73 +37,63 @@ public class ExceptionMatcher extends DiagnosingMatcher<Throwable>
     return new ExceptionMatcher(clazz);
   }
 
-  private final AllOf<Throwable> delegate;
-  private final ArrayList<Matcher<? super Throwable>> matcherList;
+  private final List<Consumer<Throwable>> assertions = new ArrayList<>();
   private final Class<? extends Throwable> clazz;
 
   public ExceptionMatcher(Class<? extends Throwable> clazz)
   {
     this.clazz = clazz;
 
-    matcherList = new ArrayList<>();
-    delegate = new AllOf<>(matcherList);
   }
 
-  public ExceptionMatcher expectMessageIs(String s)
+  public ExceptionMatcher expectMessageIs(final String message)
   {
-    return expectMessage(Matchers.equalTo(s));
-  }
-
-  public ExceptionMatcher expectMessageContains(String contains)
-  {
-    return expectMessage(Matchers.containsString(contains));
+    assertions.add(exception -> Assertions.assertEquals(message, exception.getMessage()));
+    return this;
   }
 
-  public ExceptionMatcher expectMessage(Matcher<String> messageMatcher)
+  public ExceptionMatcher expectMessageContains(final String contains)
   {
-    matcherList.add(0, DruidMatchers.fn("message", Throwable::getMessage, messageMatcher));
+    assertions.add(exception -> {
+      Assertions.assertNotNull(exception.getMessage());
+      Assertions.assertTrue(exception.getMessage().contains(contains));
+    });
     return this;
   }
 
-  public ExceptionMatcher expectCause(Matcher<Throwable> causeMatcher)
+  public ExceptionMatcher expectCause(final ExceptionMatcher causeMatcher)
   {
-    matcherList.add(0, DruidMatchers.fn("cause", Throwable::getCause, causeMatcher));
+    assertions.add(exception -> causeMatcher.assertThat(exception.getCause()));
     return this;
   }
 
-  public ExceptionMatcher expectRootCause(Matcher<Throwable> causeMatcher)
+  public ExceptionMatcher expectRootCause(final ExceptionMatcher causeMatcher)
   {
-    matcherList.add(0, DruidMatchers.fn("rootCause", Throwables::getRootCause, causeMatcher));
+    assertions.add(exception -> causeMatcher.assertThat(Throwables.getRootCause(exception)));
     return this;
   }
 
-  @Override
-  protected boolean matches(Object item, Description mismatchDescription)
+  public boolean matches(final Throwable actual)
   {
-    return delegate.matches(item, mismatchDescription);
+    try {
+      assertThat(actual);
+      return true;
+    }
+    catch (AssertionError e) {
+      return false;
+    }
   }
 
-  @Override
-  public void describeTo(Description description)
+  public void assertThat(final Throwable actual)
   {
-    delegate.describeTo(description);
+    Assertions.assertNotNull(actual);
+    assertions.forEach(assertion -> assertion.accept(actual));
   }
 
-  public <T> void assertThrowsAndMatches(ThrowingSupplier fn)
+  public void assertThrowsAndMatches(final ThrowingSupplier fn)
   {
-    boolean thrown = false;
-    try {
-      fn.get();
-    }
-    catch (Throwable e) {
-      if (clazz.isInstance(e)) {
-        MatcherAssert.assertThat(e, this);
-        thrown = true;
-      } else {
-        throw new RuntimeException(e);
-      }
-    }
-    MatcherAssert.assertThat(thrown, Matchers.is(true));
+    final Throwable exception = Assertions.assertThrows(clazz, fn::get);
+    assertThat(exception);
   }
 
   public interface ThrowingSupplier
diff --git a/processing/src/test/java/org/apache/druid/extendedset/intset/ImmutableConciseSetIntersectionTest.java b/processing/src/test/java/org/apache/druid/extendedset/intset/ImmutableConciseSetIntersectionTest.java
index 1ee347ea67a..45b6e4ecfbc 100644
--- a/processing/src/test/java/org/apache/druid/extendedset/intset/ImmutableConciseSetIntersectionTest.java
+++ b/processing/src/test/java/org/apache/druid/extendedset/intset/ImmutableConciseSetIntersectionTest.java
@@ -19,28 +19,28 @@
 
 package org.apache.druid.extendedset.intset;
 
-import junit.framework.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedClass;
+import org.junit.jupiter.params.provider.MethodSource;
 
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 
-@RunWith(Parameterized.class)
+@ParameterizedClass
+@MethodSource("parameters")
 public class ImmutableConciseSetIntersectionTest
 {
-  @Parameterized.Parameters
-  public static List<Object[]> parameters()
+  public static List<Boolean> parameters()
   {
-    return Arrays.asList(new Object[] {false}, new Object[] {true});
+    return Arrays.asList(false, true);
   }
 
-  private boolean compact;
+  private final boolean compact;
 
-  public ImmutableConciseSetIntersectionTest(boolean compact)
+  public ImmutableConciseSetIntersectionTest(final boolean compact)
   {
     this.compact = compact;
   }
@@ -588,6 +588,6 @@ public class ImmutableConciseSetIntersectionTest
     while (itr.hasNext()) {
       actual.add(itr.next());
     }
-    Assert.assertEquals(expected, actual);
+    Assertions.assertEquals(expected, actual);
   }
 }
diff --git a/processing/src/test/java/org/apache/druid/extendedset/intset/ImmutableConciseSetTest.java b/processing/src/test/java/org/apache/druid/extendedset/intset/ImmutableConciseSetTest.java
index 1107571cf03..28d12b69ab0 100755
--- a/processing/src/test/java/org/apache/druid/extendedset/intset/ImmutableConciseSetTest.java
+++ b/processing/src/test/java/org/apache/druid/extendedset/intset/ImmutableConciseSetTest.java
@@ -19,10 +19,10 @@
 
 package org.apache.druid.extendedset.intset;
 
-import junit.framework.Assert;
 import org.apache.druid.java.util.common.StringUtils;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
 
 import java.nio.IntBuffer;
 import java.util.ArrayList;
@@ -50,9 +50,9 @@ public class ImmutableConciseSetTest
     ImmutableConciseSet iSet = ImmutableConciseSet.newImmutableFromMutable(set);
 
     ImmutableConciseSet.WordIterator itr = iSet.newWordIterator();
-    Assert.assertEquals(0x8000003E, itr.next());
+    Assertions.assertEquals(0x8000003E, itr.next());
 
-    Assert.assertEquals(itr.hasNext(), false);
+    Assertions.assertEquals(itr.hasNext(), false);
   }
 
   @Test
@@ -66,9 +66,9 @@ public class ImmutableConciseSetTest
     ImmutableConciseSet iSet = ImmutableConciseSet.newImmutableFromMutable(set);
 
     ImmutableConciseSet.WordIterator itr = iSet.newWordIterator();
-    Assert.assertEquals(0x40000C98, itr.next());
-    Assert.assertEquals(0x81FFFFFF, itr.next());
-    Assert.assertEquals(itr.hasNext(), false);
+    Assertions.assertEquals(0x40000C98, itr.next());
+    Assertions.assertEquals(0x81FFFFFF, itr.next());
+    Assertions.assertEquals(itr.hasNext(), false);
   }
 
   /**
@@ -86,9 +86,9 @@ public class ImmutableConciseSetTest
 
     ImmutableConciseSet.WordIterator itr = iSet.newWordIterator();
     itr.advanceTo(50);
-    Assert.assertEquals(1073744998, itr.next());
-    Assert.assertEquals(0x81FFFFFF, itr.next());
-    Assert.assertEquals(itr.hasNext(), false);
+    Assertions.assertEquals(1073744998, itr.next());
+    Assertions.assertEquals(0x81FFFFFF, itr.next());
+    Assertions.assertEquals(itr.hasNext(), false);
   }
 
   /**
@@ -106,8 +106,8 @@ public class ImmutableConciseSetTest
 
     ImmutableConciseSet.WordIterator itr = iSet.newWordIterator();
     itr.advanceTo(3225);
-    Assert.assertEquals(0x81FFFFFF, itr.next());
-    Assert.assertEquals(itr.hasNext(), false);
+    Assertions.assertEquals(0x81FFFFFF, itr.next());
+    Assertions.assertEquals(itr.hasNext(), false);
   }
 
   @Test
@@ -119,8 +119,8 @@ public class ImmutableConciseSetTest
 
     ImmutableConciseSet.WordIterator itr = res.newWordIterator();
 
-    Assert.assertEquals(0x40000001, itr.next());
-    Assert.assertEquals(itr.hasNext(), false);
+    Assertions.assertEquals(0x40000001, itr.next());
+    Assertions.assertEquals(itr.hasNext(), false);
   }
 
   @Test
@@ -131,8 +131,8 @@ public class ImmutableConciseSetTest
     ImmutableConciseSet res = ImmutableConciseSet.compact(new ImmutableConciseSet(IntBuffer.wrap(words)));
     ImmutableConciseSet.WordIterator itr = res.newWordIterator();
 
-    Assert.assertEquals(0x40000005, itr.next());
-    Assert.assertEquals(itr.hasNext(), false);
+    Assertions.assertEquals(0x40000005, itr.next());
+    Assertions.assertEquals(itr.hasNext(), false);
   }
 
   @Test
@@ -143,9 +143,9 @@ public class ImmutableConciseSetTest
     ImmutableConciseSet res = ImmutableConciseSet.compact(new ImmutableConciseSet(IntBuffer.wrap(words)));
     ImmutableConciseSet.WordIterator itr = res.newWordIterator();
 
-    Assert.assertEquals(-1, itr.next());
-    Assert.assertEquals(0x42000004, itr.next());
-    Assert.assertEquals(itr.hasNext(), false);
+    Assertions.assertEquals(-1, itr.next());
+    Assertions.assertEquals(0x42000004, itr.next());
+    Assertions.assertEquals(itr.hasNext(), false);
   }
 
   @Test
@@ -156,8 +156,8 @@ public class ImmutableConciseSetTest
     ImmutableConciseSet res = ImmutableConciseSet.compact(new ImmutableConciseSet(IntBuffer.wrap(words)));
     ImmutableConciseSet.WordIterator itr = res.newWordIterator();
 
-    Assert.assertEquals(0x40000005, itr.next());
-    Assert.assertEquals(itr.hasNext(), false);
+    Assertions.assertEquals(0x40000005, itr.next());
+    Assertions.assertEquals(itr.hasNext(), false);
   }
 
   @Test
@@ -168,8 +168,8 @@ public class ImmutableConciseSetTest
     ImmutableConciseSet res = ImmutableConciseSet.compact(new ImmutableConciseSet(IntBuffer.wrap(words)));
     ImmutableConciseSet.WordIterator itr = res.newWordIterator();
 
-    Assert.assertEquals(0x40000009, itr.next());
-    Assert.assertEquals(itr.hasNext(), false);
+    Assertions.assertEquals(0x40000009, itr.next());
+    Assertions.assertEquals(itr.hasNext(), false);
   }
 
   @Test
@@ -180,9 +180,9 @@ public class ImmutableConciseSetTest
     ImmutableConciseSet res = ImmutableConciseSet.compact(new ImmutableConciseSet(IntBuffer.wrap(words)));
     ImmutableConciseSet.WordIterator itr = res.newWordIterator();
 
-    Assert.assertEquals(0x40000004, itr.next());
-    Assert.assertEquals(0x42000004, itr.next());
-    Assert.assertEquals(itr.hasNext(), false);
+    Assertions.assertEquals(0x40000004, itr.next());
+    Assertions.assertEquals(0x42000004, itr.next());
+    Assertions.assertEquals(itr.hasNext(), false);
   }
 
   @Test
@@ -193,9 +193,9 @@ public class ImmutableConciseSetTest
     ImmutableConciseSet res = ImmutableConciseSet.compact(new ImmutableConciseSet(IntBuffer.wrap(words)));
     ImmutableConciseSet.WordIterator itr = res.newWordIterator();
 
-    Assert.assertEquals(0x00000001, itr.next());
-    Assert.assertEquals(-1, itr.next());
-    Assert.assertEquals(itr.hasNext(), false);
+    Assertions.assertEquals(0x00000001, itr.next());
+    Assertions.assertEquals(-1, itr.next());
+    Assertions.assertEquals(itr.hasNext(), false);
   }
 
   @Test
@@ -206,9 +206,9 @@ public class ImmutableConciseSetTest
     ImmutableConciseSet res = ImmutableConciseSet.compact(new ImmutableConciseSet(IntBuffer.wrap(words)));
     ImmutableConciseSet.WordIterator itr = res.newWordIterator();
 
-    Assert.assertEquals(0x00000005, itr.next());
-    Assert.assertEquals(-1, itr.next());
-    Assert.assertEquals(itr.hasNext(), false);
+    Assertions.assertEquals(0x00000005, itr.next());
+    Assertions.assertEquals(-1, itr.next());
+    Assertions.assertEquals(itr.hasNext(), false);
   }
 
   @Test
@@ -219,10 +219,10 @@ public class ImmutableConciseSetTest
     ImmutableConciseSet res = ImmutableConciseSet.compact(new ImmutableConciseSet(IntBuffer.wrap(words)));
     ImmutableConciseSet.WordIterator itr = res.newWordIterator();
 
-    Assert.assertEquals(0x80000000, itr.next());
-    Assert.assertEquals(0x02000004, itr.next());
-    Assert.assertEquals(-1, itr.next());
-    Assert.assertEquals(itr.hasNext(), false);
+    Assertions.assertEquals(0x80000000, itr.next());
+    Assertions.assertEquals(0x02000004, itr.next());
+    Assertions.assertEquals(-1, itr.next());
+    Assertions.assertEquals(itr.hasNext(), false);
   }
 
   @Test
@@ -233,9 +233,9 @@ public class ImmutableConciseSetTest
     ImmutableConciseSet res = ImmutableConciseSet.compact(new ImmutableConciseSet(IntBuffer.wrap(words)));
     ImmutableConciseSet.WordIterator itr = res.newWordIterator();
 
-    Assert.assertEquals(0x00000005, itr.next());
-    Assert.assertEquals(-1, itr.next());
-    Assert.assertEquals(itr.hasNext(), false);
+    Assertions.assertEquals(0x00000005, itr.next());
+    Assertions.assertEquals(-1, itr.next());
+    Assertions.assertEquals(itr.hasNext(), false);
   }
 
   @Test
@@ -246,9 +246,9 @@ public class ImmutableConciseSetTest
     ImmutableConciseSet res = ImmutableConciseSet.compact(new ImmutableConciseSet(IntBuffer.wrap(words)));
     ImmutableConciseSet.WordIterator itr = res.newWordIterator();
 
-    Assert.assertEquals(0x00000009, itr.next());
-    Assert.assertEquals(-1, itr.next());
-    Assert.assertEquals(itr.hasNext(), false);
+    Assertions.assertEquals(0x00000009, itr.next());
+    Assertions.assertEquals(-1, itr.next());
+    Assertions.assertEquals(itr.hasNext(), false);
   }
 
   @Test
@@ -259,10 +259,10 @@ public class ImmutableConciseSetTest
     ImmutableConciseSet res = ImmutableConciseSet.compact(new ImmutableConciseSet(IntBuffer.wrap(words)));
     ImmutableConciseSet.WordIterator itr = res.newWordIterator();
 
-    Assert.assertEquals(0x00000004, itr.next());
-    Assert.assertEquals(0x02000004, itr.next());
-    Assert.assertEquals(-1, itr.next());
-    Assert.assertEquals(itr.hasNext(), false);
+    Assertions.assertEquals(0x00000004, itr.next());
+    Assertions.assertEquals(0x02000004, itr.next());
+    Assertions.assertEquals(-1, itr.next());
+    Assertions.assertEquals(itr.hasNext(), false);
   }
 
   @Test
@@ -273,9 +273,9 @@ public class ImmutableConciseSetTest
     ImmutableConciseSet res = ImmutableConciseSet.compact(new ImmutableConciseSet(IntBuffer.wrap(words)));
     ImmutableConciseSet.WordIterator itr = res.newWordIterator();
 
-    Assert.assertEquals(0x02000001, itr.next());
-    Assert.assertEquals(-1, itr.next());
-    Assert.assertEquals(itr.hasNext(), false);
+    Assertions.assertEquals(0x02000001, itr.next());
+    Assertions.assertEquals(-1, itr.next());
+    Assertions.assertEquals(itr.hasNext(), false);
   }
 
   @Test
@@ -286,10 +286,10 @@ public class ImmutableConciseSetTest
     ImmutableConciseSet res = ImmutableConciseSet.compact(new ImmutableConciseSet(IntBuffer.wrap(words)));
     ImmutableConciseSet.WordIterator itr = res.newWordIterator();
 
-    Assert.assertEquals(0x80000003, itr.next());
-    Assert.assertEquals(0x80000000, itr.next());
-    Assert.assertEquals(-1, itr.next());
-    Assert.assertEquals(itr.hasNext(), false);
+    Assertions.assertEquals(0x80000003, itr.next());
+    Assertions.assertEquals(0x80000000, itr.next());
+    Assertions.assertEquals(-1, itr.next());
+    Assertions.assertEquals(itr.hasNext(), false);
   }
 
   @Test
@@ -300,9 +300,9 @@ public class ImmutableConciseSetTest
     ImmutableConciseSet res = ImmutableConciseSet.compact(new ImmutableConciseSet(IntBuffer.wrap(words)));
     ImmutableConciseSet.WordIterator itr = res.newWordIterator();
 
-    Assert.assertEquals(0x02000005, itr.next());
-    Assert.assertEquals(-1, itr.next());
-    Assert.assertEquals(itr.hasNext(), false);
+    Assertions.assertEquals(0x02000005, itr.next());
+    Assertions.assertEquals(-1, itr.next());
+    Assertions.assertEquals(itr.hasNext(), false);
   }
 
   @Test
@@ -313,10 +313,10 @@ public class ImmutableConciseSetTest
     ImmutableConciseSet res = ImmutableConciseSet.compact(new ImmutableConciseSet(IntBuffer.wrap(words)));
     ImmutableConciseSet.WordIterator itr = res.newWordIterator();
 
-    Assert.assertEquals(0x80000003, itr.next());
-    Assert.assertEquals(0x00000004, itr.next());
-    Assert.assertEquals(-1, itr.next());
-    Assert.assertEquals(itr.hasNext(), false);
+    Assertions.assertEquals(0x80000003, itr.next());
+    Assertions.assertEquals(0x00000004, itr.next());
+    Assertions.assertEquals(-1, itr.next());
+    Assertions.assertEquals(itr.hasNext(), false);
   }
 
   @Test
@@ -327,10 +327,10 @@ public class ImmutableConciseSetTest
     ImmutableConciseSet res = ImmutableConciseSet.compact(new ImmutableConciseSet(IntBuffer.wrap(words)));
     ImmutableConciseSet.WordIterator itr = res.newWordIterator();
 
-    Assert.assertEquals(0x80000001, itr.next());
-    Assert.assertEquals(0x02000004, itr.next());
-    Assert.assertEquals(-1, itr.next());
-    Assert.assertEquals(itr.hasNext(), false);
+    Assertions.assertEquals(0x80000001, itr.next());
+    Assertions.assertEquals(0x02000004, itr.next());
+    Assertions.assertEquals(-1, itr.next());
+    Assertions.assertEquals(itr.hasNext(), false);
   }
 
   @Test
@@ -341,8 +341,8 @@ public class ImmutableConciseSetTest
     ImmutableConciseSet res = ImmutableConciseSet.compact(new ImmutableConciseSet(IntBuffer.wrap(words)));
     ImmutableConciseSet.WordIterator itr = res.newWordIterator();
 
-    Assert.assertEquals(0x42000001, itr.next());
-    Assert.assertEquals(itr.hasNext(), false);
+    Assertions.assertEquals(0x42000001, itr.next());
+    Assertions.assertEquals(itr.hasNext(), false);
   }
 
   @Test
@@ -353,9 +353,9 @@ public class ImmutableConciseSetTest
     ImmutableConciseSet res = ImmutableConciseSet.compact(new ImmutableConciseSet(IntBuffer.wrap(words)));
     ImmutableConciseSet.WordIterator itr = res.newWordIterator();
 
-    Assert.assertEquals(0xFFFFFFEE, itr.next());
-    Assert.assertEquals(-1, itr.next());
-    Assert.assertEquals(itr.hasNext(), false);
+    Assertions.assertEquals(0xFFFFFFEE, itr.next());
+    Assertions.assertEquals(-1, itr.next());
+    Assertions.assertEquals(itr.hasNext(), false);
   }
 
   @Test
@@ -366,8 +366,8 @@ public class ImmutableConciseSetTest
     ImmutableConciseSet res = ImmutableConciseSet.compact(new ImmutableConciseSet(IntBuffer.wrap(words)));
     ImmutableConciseSet.WordIterator itr = res.newWordIterator();
 
-    Assert.assertEquals(0x42000005, itr.next());
-    Assert.assertEquals(itr.hasNext(), false);
+    Assertions.assertEquals(0x42000005, itr.next());
+    Assertions.assertEquals(itr.hasNext(), false);
   }
 
   @Test
@@ -378,9 +378,9 @@ public class ImmutableConciseSetTest
     ImmutableConciseSet res = ImmutableConciseSet.compact(new ImmutableConciseSet(IntBuffer.wrap(words)));
     ImmutableConciseSet.WordIterator itr = res.newWordIterator();
 
-    Assert.assertEquals(0xFFFFFFFC, itr.next());
-    Assert.assertEquals(0x40000004, itr.next());
-    Assert.assertEquals(itr.hasNext(), false);
+    Assertions.assertEquals(0xFFFFFFFC, itr.next());
+    Assertions.assertEquals(0x40000004, itr.next());
+    Assertions.assertEquals(itr.hasNext(), false);
   }
 
   @Test
@@ -391,9 +391,9 @@ public class ImmutableConciseSetTest
     ImmutableConciseSet res = ImmutableConciseSet.compact(new ImmutableConciseSet(IntBuffer.wrap(words)));
     ImmutableConciseSet.WordIterator itr = res.newWordIterator();
 
-    Assert.assertEquals(0xFFFFFFFE, itr.next());
-    Assert.assertEquals(0x42000004, itr.next());
-    Assert.assertEquals(itr.hasNext(), false);
+    Assertions.assertEquals(0xFFFFFFFE, itr.next());
+    Assertions.assertEquals(0x42000004, itr.next());
+    Assertions.assertEquals(itr.hasNext(), false);
   }
 
   @Test
@@ -404,9 +404,9 @@ public class ImmutableConciseSetTest
     ImmutableConciseSet res = ImmutableConciseSet.compact(new ImmutableConciseSet(IntBuffer.wrap(words)));
     ImmutableConciseSet.WordIterator itr = res.newWordIterator();
 
-    Assert.assertEquals(0xFFFFFFFE, itr.next());
-    Assert.assertEquals(0xFFEFFEFF, itr.next());
-    Assert.assertEquals(itr.hasNext(), false);
+    Assertions.assertEquals(0xFFFFFFFE, itr.next());
+    Assertions.assertEquals(0xFFEFFEFF, itr.next());
+    Assertions.assertEquals(itr.hasNext(), false);
   }
 
   /**
@@ -1136,7 +1136,7 @@ public class ImmutableConciseSetTest
     while (itr.hasNext()) {
       actual.add(itr.next());
     }
-    Assert.assertEquals(expected, actual);
+    Assertions.assertEquals(expected, actual);
   }
 
   /**
@@ -1339,7 +1339,7 @@ public class ImmutableConciseSetTest
       for (int i = 0; i < length; i++) {
         final int n = intIterator.next();
         if (i != n) {
-          Assert.assertEquals(StringUtils.format("Failure at bit [%d] on length [%d]", i, length), i, n);
+          Assertions.assertEquals(i, n, StringUtils.format("Failure at bit [%d] on length [%d]", i, length));
         }
       }
       NoSuchElementException ex = null;
@@ -1349,7 +1349,7 @@ public class ImmutableConciseSetTest
       catch (NoSuchElementException e) {
         ex = e;
       }
-      Assert.assertNotNull(ex);
+      Assertions.assertNotNull(ex);
     }
   }
 
@@ -1428,7 +1428,7 @@ public class ImmutableConciseSetTest
     verifyComplement(expected, testSet, length);
   }
 
-  @Ignore
+  @Disabled
 
   @Test
   public void testComplement14()
@@ -1462,7 +1462,7 @@ public class ImmutableConciseSetTest
     while (itr.hasNext()) {
       actual.add(itr.next());
     }
-    Assert.assertEquals(expected, actual);
+    Assertions.assertEquals(expected, actual);
   }
 
   @Test
@@ -1483,8 +1483,8 @@ public class ImmutableConciseSetTest
     final ImmutableConciseSet immutableConciseSet = ImmutableConciseSet.newImmutableFromMutable(conciseSet);
     for (int i = 0; i < max + 10; ++i) {
       final String s = Integer.toString(i);
-      Assert.assertEquals(s, integerSet.contains(i), conciseSet.contains(i));
-      Assert.assertEquals(s, integerSet.contains(i), immutableConciseSet.contains(i));
+      Assertions.assertEquals(integerSet.contains(i), conciseSet.contains(i), s);
+      Assertions.assertEquals(integerSet.contains(i), immutableConciseSet.contains(i), s);
     }
   }
 }
diff --git a/processing/src/test/java/org/apache/druid/frame/channel/ReadableByteChunksFrameChannelTest.java b/processing/src/test/java/org/apache/druid/frame/channel/ReadableByteChunksFrameChannelTest.java
index 1359da38fbc..29d995b8afc 100644
--- a/processing/src/test/java/org/apache/druid/frame/channel/ReadableByteChunksFrameChannelTest.java
+++ b/processing/src/test/java/org/apache/druid/frame/channel/ReadableByteChunksFrameChannelTest.java
@@ -71,7 +71,7 @@ public class ReadableByteChunksFrameChannelTest
   public static class NonParameterizedTests extends InitializedNullHandlingTest
   {
     @RegisterExtension
-    public final TemporaryFolderExtension temporaryFolder = new TemporaryFolderExtension();
+    public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
     @Test
     public void testZeroBytes()
@@ -226,7 +226,7 @@ public class ReadableByteChunksFrameChannelTest
   public static class ParameterizedWithTestIndexTests extends InitializedNullHandlingTest
   {
     @RegisterExtension
-    public final TemporaryFolderExtension temporaryFolder = new TemporaryFolderExtension();
+    public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
     private final FrameType frameType;
     private final int maxRowsPerFrame;
diff --git a/processing/src/test/java/org/apache/druid/frame/channel/ReadableInputStreamFrameChannelTest.java b/processing/src/test/java/org/apache/druid/frame/channel/ReadableInputStreamFrameChannelTest.java
index a144e6e60a8..bbaeaecf266 100644
--- a/processing/src/test/java/org/apache/druid/frame/channel/ReadableInputStreamFrameChannelTest.java
+++ b/processing/src/test/java/org/apache/druid/frame/channel/ReadableInputStreamFrameChannelTest.java
@@ -31,11 +31,12 @@ import org.apache.druid.java.util.common.guava.Sequences;
 import org.apache.druid.segment.TestIndex;
 import org.apache.druid.segment.incremental.IncrementalIndexCursorFactory;
 import org.apache.druid.testing.InitializedNullHandlingTest;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.hamcrest.MatcherAssert;
 import org.hamcrest.Matchers;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.ByteArrayInputStream;
 import java.io.File;
@@ -50,8 +51,8 @@ import java.util.concurrent.ExecutorService;
 public class ReadableInputStreamFrameChannelTest extends InitializedNullHandlingTest
 {
 
-  @TempDir
-  File temporaryFolder;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   final IncrementalIndexCursorFactory cursorFactory =
       new IncrementalIndexCursorFactory(TestIndex.getIncrementalTestIndex());
@@ -88,7 +89,7 @@ public class ReadableInputStreamFrameChannelTest extends InitializedNullHandling
   {
     final File file = FrameTestUtil.writeFrameFile(
         Sequences.empty(),
-        File.createTempFile("tmp", null, temporaryFolder)
+        temporaryFolder.newFile()
     );
     ReadableInputStreamFrameChannel readableInputStreamFrameChannel = ReadableInputStreamFrameChannel.open(
         Files.newInputStream(file.toPath()),
@@ -112,7 +113,7 @@ public class ReadableInputStreamFrameChannelTest extends InitializedNullHandling
   @Test
   public void testZeroBytesFrameFile() throws IOException
   {
-    final File file = File.createTempFile("tmp", null, temporaryFolder);
+    final File file = temporaryFolder.newFile();
     FileOutputStream outputStream = new FileOutputStream(file);
     outputStream.write(new byte[0]);
     outputStream.close();
@@ -154,7 +155,7 @@ public class ReadableInputStreamFrameChannelTest extends InitializedNullHandling
                             .allocator(ArenaMemoryAllocator.create(ByteBuffer.allocate(allocatorSize)))
                             .frameType(FrameType.latestRowBased())
                             .frames(),
-        File.createTempFile("tmp", null, temporaryFolder)
+        temporaryFolder.newFile()
     );
 
     final byte[] truncatedFile = new byte[truncatedSize];
@@ -184,7 +185,7 @@ public class ReadableInputStreamFrameChannelTest extends InitializedNullHandling
   @Test
   public void testIncorrectFrameFile() throws IOException
   {
-    final File file = File.createTempFile("tmp", null, temporaryFolder);
+    final File file = temporaryFolder.newFile();
     FileOutputStream outputStream = new FileOutputStream(file);
     outputStream.write(10);
     outputStream.close();
@@ -264,7 +265,7 @@ public class ReadableInputStreamFrameChannelTest extends InitializedNullHandling
                               .maxRowsPerFrame(10)
                               .frameType(FrameType.latestRowBased())
                               .frames(),
-          File.createTempFile("tmp", null, temporaryFolder)
+          temporaryFolder.newFile()
       );
       return Files.newInputStream(file.toPath());
     }
diff --git a/processing/src/test/java/org/apache/druid/frame/file/FrameFileHttpResponseHandlerTest.java b/processing/src/test/java/org/apache/druid/frame/file/FrameFileHttpResponseHandlerTest.java
index 75dcece8f0c..3e0ce5af651 100644
--- a/processing/src/test/java/org/apache/druid/frame/file/FrameFileHttpResponseHandlerTest.java
+++ b/processing/src/test/java/org/apache/druid/frame/file/FrameFileHttpResponseHandlerTest.java
@@ -68,7 +68,7 @@ import java.util.List;
 public class FrameFileHttpResponseHandlerTest extends InitializedNullHandlingTest
 {
   @RegisterExtension
-  public final TemporaryFolderExtension temporaryFolder = new TemporaryFolderExtension();
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   private final int maxRowsPerFrame;
 
diff --git a/processing/src/test/java/org/apache/druid/frame/file/FrameFileTest.java b/processing/src/test/java/org/apache/druid/frame/file/FrameFileTest.java
index 536cce904ca..ceb7132e82d 100644
--- a/processing/src/test/java/org/apache/druid/frame/file/FrameFileTest.java
+++ b/processing/src/test/java/org/apache/druid/frame/file/FrameFileTest.java
@@ -141,7 +141,7 @@ public class FrameFileTest extends InitializedNullHandlingTest
   }
 
   @RegisterExtension
-  public final TemporaryFolderExtension temporaryFolder = new TemporaryFolderExtension();
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   /**
    * Writes the frame file for one case into the temporary folder, and returns it.
diff --git a/processing/src/test/java/org/apache/druid/frame/file/FrameFileWireTransferableTest.java b/processing/src/test/java/org/apache/druid/frame/file/FrameFileWireTransferableTest.java
index f989657e511..ac26e31dd40 100644
--- a/processing/src/test/java/org/apache/druid/frame/file/FrameFileWireTransferableTest.java
+++ b/processing/src/test/java/org/apache/druid/frame/file/FrameFileWireTransferableTest.java
@@ -34,16 +34,16 @@ import org.apache.druid.segment.CursorFactory;
 import org.apache.druid.segment.TestIndex;
 import org.apache.druid.segment.incremental.IncrementalIndexCursorFactory;
 import org.apache.druid.testing.InitializedNullHandlingTest;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.File;
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.nio.channels.Channels;
 import java.nio.file.Files;
-import java.nio.file.Path;
 import java.util.List;
 import java.util.Map;
 
@@ -53,8 +53,8 @@ import java.util.Map;
  */
 public class FrameFileWireTransferableTest extends InitializedNullHandlingTest
 {
-  @TempDir
-  Path tempDir;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   @Test
   public void testRacMethodThrowsWithoutDeserializerForRacEntry() throws IOException
@@ -87,7 +87,7 @@ public class FrameFileWireTransferableTest extends InitializedNullHandlingTest
     final List<Frame> frameList = frames.toList();
 
     // Write frame file with useWireTransferableForFrames = true (RAC format)
-    final File file = Files.createTempFile(tempDir, "junit", null).toFile();
+    final File file = temporaryFolder.newFile();
     try (final FrameFileWriter writer = FrameFileWriter.open(
         Channels.newChannel(Files.newOutputStream(file.toPath())),
         null,
diff --git a/processing/src/test/java/org/apache/druid/frame/file/FrameFileWriterTest.java b/processing/src/test/java/org/apache/druid/frame/file/FrameFileWriterTest.java
index e8ac01a4b63..7fc7cd01ced 100644
--- a/processing/src/test/java/org/apache/druid/frame/file/FrameFileWriterTest.java
+++ b/processing/src/test/java/org/apache/druid/frame/file/FrameFileWriterTest.java
@@ -29,23 +29,23 @@ import org.apache.druid.java.util.common.guava.Sequence;
 import org.apache.druid.segment.TestIndex;
 import org.apache.druid.segment.incremental.IncrementalIndexCursorFactory;
 import org.apache.druid.testing.InitializedNullHandlingTest;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.hamcrest.CoreMatchers;
 import org.hamcrest.MatcherAssert;
 import org.hamcrest.Matchers;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.File;
 import java.io.IOException;
 import java.nio.file.Files;
-import java.nio.file.Path;
 import java.nio.file.StandardOpenOption;
 
 public class FrameFileWriterTest extends InitializedNullHandlingTest
 {
-  @TempDir
-  Path tempDir;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   @Test
   public void test_abort_afterAllFrames() throws IOException
@@ -55,7 +55,7 @@ public class FrameFileWriterTest extends InitializedNullHandlingTest
                                                        .frameType(FrameType.latestRowBased())
                                                        .frames();
 
-    final File file = Files.createTempFile(tempDir, "junit", null).toFile();
+    final File file = temporaryFolder.newFile();
     final FrameFileWriter fileWriter = FrameFileWriter.open(
         Files.newByteChannel(
             file.toPath(),
diff --git a/processing/src/test/java/org/apache/druid/frame/processor/ComposingOutputChannelFactoryTest.java b/processing/src/test/java/org/apache/druid/frame/processor/ComposingOutputChannelFactoryTest.java
index c8981d2ebd6..a273ad8c871 100644
--- a/processing/src/test/java/org/apache/druid/frame/processor/ComposingOutputChannelFactoryTest.java
+++ b/processing/src/test/java/org/apache/druid/frame/processor/ComposingOutputChannelFactoryTest.java
@@ -23,29 +23,28 @@ import com.google.common.collect.ImmutableList;
 import org.apache.druid.frame.channel.ByteTracker;
 import org.apache.druid.frame.channel.WritableFrameChannel;
 import org.apache.druid.frame.testutil.FrameTestUtil;
-import org.apache.druid.java.util.common.FileUtils;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.IOException;
-import java.nio.file.Path;
 import java.util.concurrent.ExecutionException;
 
 public class ComposingOutputChannelFactoryTest extends OutputChannelFactoryTest
 {
-  @TempDir
-  static Path folder;
+  @RegisterExtension
+  public static final TemporaryFolderExtension SHARED_TEMPORARY_FOLDER = TemporaryFolderExtension.classScoped();
 
-  public ComposingOutputChannelFactoryTest()
+  public ComposingOutputChannelFactoryTest() throws IOException
   {
     super(
         new ComposingOutputChannelFactory(
             ImmutableList.of(
                 // TODO : currently hardcoded 256k since it allows one frame to be written to each factory
                 // nicer to do that automatically
-                new FileOutputChannelFactory(FileUtils.createTempDirInLocation(folder, "f1"), 100, new ByteTracker(256_000), FrameTestUtil.WT_CONTEXT_LEGACY),
-                new FileOutputChannelFactory(FileUtils.createTempDirInLocation(folder, "f2"), 100, new ByteTracker(256_000), FrameTestUtil.WT_CONTEXT_LEGACY)
+                new FileOutputChannelFactory(SHARED_TEMPORARY_FOLDER.newFolder(), 100, new ByteTracker(256_000), FrameTestUtil.WT_CONTEXT_LEGACY),
+                new FileOutputChannelFactory(SHARED_TEMPORARY_FOLDER.newFolder(), 100, new ByteTracker(256_000), FrameTestUtil.WT_CONTEXT_LEGACY)
             ),
             100
         ),
@@ -58,7 +57,7 @@ public class ComposingOutputChannelFactoryTest extends OutputChannelFactoryTest
   {
     ComposingOutputChannelFactory outputChannelFactory = new ComposingOutputChannelFactory(
         ImmutableList.of(
-            new FileOutputChannelFactory(FileUtils.createTempDirInLocation(folder, "t2"), 100, new ByteTracker(1), FrameTestUtil.WT_CONTEXT_LEGACY),
+            new FileOutputChannelFactory(SHARED_TEMPORARY_FOLDER.newFolder(), 100, new ByteTracker(1), FrameTestUtil.WT_CONTEXT_LEGACY),
             new ThrowingOutputChannelFactory() // adding this to check if it gets called
         ),
         100
@@ -81,7 +80,7 @@ public class ComposingOutputChannelFactoryTest extends OutputChannelFactoryTest
     // can handle the test data frames
     ComposingOutputChannelFactory outputChannelFactory = new ComposingOutputChannelFactory(
         ImmutableList.of(
-            new FileOutputChannelFactory(FileUtils.createTempDirInLocation(folder, "t3"), 100, new ByteTracker(1_000_000), FrameTestUtil.WT_CONTEXT_LEGACY),
+            new FileOutputChannelFactory(SHARED_TEMPORARY_FOLDER.newFolder(), 100, new ByteTracker(1_000_000), FrameTestUtil.WT_CONTEXT_LEGACY),
             new ThrowingOutputChannelFactory()
         ),
         100
diff --git a/processing/src/test/java/org/apache/druid/frame/processor/FileOutputChannelFactoryTest.java b/processing/src/test/java/org/apache/druid/frame/processor/FileOutputChannelFactoryTest.java
index abb818f56f8..9b7757ce5c3 100644
--- a/processing/src/test/java/org/apache/druid/frame/processor/FileOutputChannelFactoryTest.java
+++ b/processing/src/test/java/org/apache/druid/frame/processor/FileOutputChannelFactoryTest.java
@@ -20,17 +20,16 @@
 package org.apache.druid.frame.processor;
 
 import org.apache.druid.frame.testutil.FrameTestUtil;
-import org.junit.jupiter.api.io.TempDir;
-
-import java.nio.file.Path;
+import org.apache.druid.testing.TemporaryFolderExtension;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 public class FileOutputChannelFactoryTest extends OutputChannelFactoryTest
 {
-  @TempDir
-  static Path folder;
+  @RegisterExtension
+  public static final TemporaryFolderExtension SHARED_TEMPORARY_FOLDER = TemporaryFolderExtension.classScoped();
 
   public FileOutputChannelFactoryTest()
   {
-    super(new FileOutputChannelFactory(folder.toFile(), 100, null, FrameTestUtil.WT_CONTEXT_LEGACY), 100);
+    super(new FileOutputChannelFactory(SHARED_TEMPORARY_FOLDER.getRoot(), 100, null, FrameTestUtil.WT_CONTEXT_LEGACY), 100);
   }
 }
diff --git a/processing/src/test/java/org/apache/druid/frame/processor/FrameProcessorExecutorTest.java b/processing/src/test/java/org/apache/druid/frame/processor/FrameProcessorExecutorTest.java
index 8154ff4d271..d1426a7be40 100644
--- a/processing/src/test/java/org/apache/druid/frame/processor/FrameProcessorExecutorTest.java
+++ b/processing/src/test/java/org/apache/druid/frame/processor/FrameProcessorExecutorTest.java
@@ -54,15 +54,11 @@ import org.apache.druid.segment.incremental.IncrementalIndexCursorFactory;
 import org.apache.druid.testing.InitializedNullHandlingTest;
 import org.apache.druid.testing.TemporaryFolderExtension;
 import org.apache.druid.utils.CloseableUtils;
-import org.hamcrest.CoreMatchers;
-import org.hamcrest.MatcherAssert;
-import org.hamcrest.Matchers;
-import org.junit.After;
-import org.junit.Before;
 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 org.junit.jupiter.api.Timeout;
 import org.junit.jupiter.api.extension.RegisterExtension;
 import org.junit.jupiter.params.ParameterizedClass;
 import org.junit.jupiter.params.provider.MethodSource;
@@ -199,10 +195,7 @@ public class FrameProcessorExecutorTest
           failerFuture::get
       );
 
-      MatcherAssert.assertThat(
-          e.getCause().getCause(),
-          Matchers.hasProperty("message", CoreMatchers.containsString("failure!"))
-      );
+      Assertions.assertTrue(e.getCause().getCause().getMessage().contains("failure!"));
 
       final ReadableFrameChannel outReadableChannel = outChannel.readable();
       Assertions.assertTrue(outReadableChannel.canRead());
@@ -212,10 +205,7 @@ public class FrameProcessorExecutorTest
           outReadableChannel::readFrame
       );
 
-      MatcherAssert.assertThat(
-          readException.getCause(),
-          Matchers.hasProperty("message", CoreMatchers.containsString("failure!"))
-      );
+      Assertions.assertTrue(readException.getCause().getMessage().contains("failure!"));
 
       Assertions.assertTrue(outReadableChannel.isFinished()); // Finished now that we read the error
     }
@@ -257,7 +247,7 @@ public class FrameProcessorExecutorTest
     }
 
     @Test
-    @org.junit.jupiter.api.Timeout(value = 30_000L, unit = java.util.concurrent.TimeUnit.MILLISECONDS)
+    @Timeout(value = 30_000L, unit = TimeUnit.MILLISECONDS)
     public void test_futureCancel_sleepy() throws Exception
     {
       final SleepyFrameProcessor processor = new SleepyFrameProcessor();
@@ -384,7 +374,7 @@ public class FrameProcessorExecutorTest
             Assertions.assertTrue(future.isCancelled());
 
             final Exception e = Assertions.assertThrows(Exception.class, future::get);
-            MatcherAssert.assertThat(e, CoreMatchers.instanceOf(CancellationException.class));
+            Assertions.assertInstanceOf(CancellationException.class, e);
           }
         }
 
@@ -460,7 +450,7 @@ public class FrameProcessorExecutorTest
 
       // Verify exception
       final ExecutionException e = Assertions.assertThrows(ExecutionException.class, processorFuture::get);
-      MatcherAssert.assertThat(e.getCause(), CoreMatchers.instanceOf(CancellationException.class));
+      Assertions.assertInstanceOf(CancellationException.class, e.getCause());
     }
 
     @Test
@@ -480,15 +470,15 @@ public class FrameProcessorExecutorTest
 
       // Verify exception
       final ExecutionException e = Assertions.assertThrows(ExecutionException.class, processorFuture::get);
-      MatcherAssert.assertThat(e.getCause(), CoreMatchers.instanceOf(RuntimeException.class));
-      MatcherAssert.assertThat(e.getCause(), Matchers.hasProperty("message", CoreMatchers.equalTo("oops")));
+      Assertions.assertInstanceOf(RuntimeException.class, e.getCause());
+      Assertions.assertEquals("oops", e.getCause().getMessage());
     }
   }
 
   public abstract static class BaseFrameProcessorExecutorTestSuite extends InitializedNullHandlingTest
   {
     @RegisterExtension
-    public final TemporaryFolderExtension temporaryFolder = new TemporaryFolderExtension();
+    public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
     public final int numThreads;
 
     protected FrameProcessorExecutor exec;
@@ -498,8 +488,6 @@ public class FrameProcessorExecutorTest
       this.numThreads = numThreads;
     }
 
-    // Keep the JUnit 4 annotations for un-migrated test-jar consumers of this shared base class.
-    @Before
     @BeforeEach
     public void setUp() throws Exception
     {
@@ -513,7 +501,6 @@ public class FrameProcessorExecutorTest
       );
     }
 
-    @After
     @AfterEach
     public void tearDown() throws Exception
     {
diff --git a/processing/src/test/java/org/apache/druid/frame/processor/ReadableFileFrameChannelTest.java b/processing/src/test/java/org/apache/druid/frame/processor/ReadableFileFrameChannelTest.java
index 06972c094d7..97c6571c369 100644
--- a/processing/src/test/java/org/apache/druid/frame/processor/ReadableFileFrameChannelTest.java
+++ b/processing/src/test/java/org/apache/druid/frame/processor/ReadableFileFrameChannelTest.java
@@ -30,16 +30,15 @@ import org.apache.druid.segment.CursorFactory;
 import org.apache.druid.segment.QueryableIndexCursorFactory;
 import org.apache.druid.segment.TestIndex;
 import org.apache.druid.testing.InitializedNullHandlingTest;
+import org.apache.druid.testing.TemporaryFolderExtension;
 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 org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.File;
 import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
 import java.util.List;
 
 public class ReadableFileFrameChannelTest extends InitializedNullHandlingTest
@@ -50,8 +49,8 @@ public class ReadableFileFrameChannelTest extends InitializedNullHandlingTest
   private FrameReader frameReader;
   private FrameFile frameFile;
 
-  @TempDir
-  Path tempDir;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   @BeforeEach
   public void setUp() throws IOException
@@ -62,7 +61,7 @@ public class ReadableFileFrameChannelTest extends InitializedNullHandlingTest
                             .frameType(FrameType.latestRowBased())
                             .maxRowsPerFrame(ROWS_PER_FRAME)
                             .frames(),
-        Files.createTempFile(tempDir, "junit", null).toFile()
+        temporaryFolder.newFile()
     );
     allRows = FrameTestUtil.readRowsFromCursorFactory(cursorFactory).toList();
     frameReader = FrameReader.create(cursorFactory.getRowSignature());
diff --git a/processing/src/test/java/org/apache/druid/frame/processor/SuperSorterTest.java b/processing/src/test/java/org/apache/druid/frame/processor/SuperSorterTest.java
index 462855c419f..309baf36a0c 100644
--- a/processing/src/test/java/org/apache/druid/frame/processor/SuperSorterTest.java
+++ b/processing/src/test/java/org/apache/druid/frame/processor/SuperSorterTest.java
@@ -101,7 +101,7 @@ public class SuperSorterTest
     private static final int FRAME_SIZE = 1_000_000;
 
     @RegisterExtension
-    public final TemporaryFolderExtension temporaryFolder = new TemporaryFolderExtension();
+    public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
     private FrameProcessorExecutor exec;
 
@@ -249,7 +249,7 @@ public class SuperSorterTest
     private static final Map<ClusterBy, List<List<Object>>> SORTED_TEST_ROWS = new HashMap<>();
 
     @RegisterExtension
-    public final TemporaryFolderExtension temporaryFolder = new TemporaryFolderExtension();
+    public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
     private RowSignature signature;
     private FrameProcessorExecutor exec;
@@ -846,7 +846,7 @@ public class SuperSorterTest
     }
 
     @RegisterExtension
-    public final TemporaryFolderExtension temporaryFolder = new TemporaryFolderExtension();
+    public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
     private final int maxRowsPerFrame;
     private final int maxChannelsPerMerger;
diff --git a/processing/src/test/java/org/apache/druid/granularity/QueryGranularityTest.java b/processing/src/test/java/org/apache/druid/granularity/QueryGranularityTest.java
index 5ffc39a2f9f..e9f4677bf05 100644
--- a/processing/src/test/java/org/apache/druid/granularity/QueryGranularityTest.java
+++ b/processing/src/test/java/org/apache/druid/granularity/QueryGranularityTest.java
@@ -48,8 +48,8 @@ import org.joda.time.Months;
 import org.joda.time.Period;
 import org.joda.time.Weeks;
 import org.joda.time.Years;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
 
 import java.util.Collections;
 import java.util.Iterator;
@@ -67,7 +67,7 @@ public class QueryGranularityTest extends InitializedNullHandlingTest
     final Iterator<Interval> iterator = Granularities.NONE.getIterable(Intervals.utc(0, 1000)).iterator();
     int count = 0;
     while (iterator.hasNext()) {
-      Assert.assertEquals(count, iterator.next().getStartMillis());
+      Assertions.assertEquals(count, iterator.next().getStartMillis());
       count++;
     }
   }
@@ -700,19 +700,19 @@ public class QueryGranularityTest extends InitializedNullHandlingTest
       );
 
       // Same as above, but using the millis form of the method.
-      Assert.assertEquals(
+      Assertions.assertEquals(
           DateTimes.of("2012-01-01T04:50:00.000-08:00").getMillis(),
           gran.bucketStart(DateTimes.of("2012-01-01T05:00:04.123-08:00").getMillis())
       );
-      Assert.assertEquals(
+      Assertions.assertEquals(
           DateTimes.of("2012-01-02T05:00:00.000-08:00").getMillis(),
           gran.bucketStart(DateTimes.of("2012-01-02T07:00:04.123-08:00").getMillis())
       );
-      Assert.assertEquals(
+      Assertions.assertEquals(
           DateTimes.of("2012-01-02T17:05:00.000-08:00").getMillis(),
           gran.bucketStart(DateTimes.of("2012-01-03T00:20:04.123-08:00").getMillis())
       );
-      Assert.assertEquals(
+      Assertions.assertEquals(
           DateTimes.of("2012-02-03T22:25:00.000-08:00").getMillis(),
           gran.bucketStart(DateTimes.of("2012-02-03T22:25:00.000-08:00").getMillis())
       );
@@ -729,19 +729,19 @@ public class QueryGranularityTest extends InitializedNullHandlingTest
           origin
       );
 
-      Assert.assertEquals(
+      Assertions.assertEquals(
           DateTimes.of("2012-01-01T17:05:04.123-08:00"),
           gran.increment(DateTimes.of("2012-01-01T05:00:04.123-08:00"))
       );
-      Assert.assertEquals(
+      Assertions.assertEquals(
           DateTimes.of("2012-01-02T19:05:04.123-08:00"),
           gran.increment(DateTimes.of("2012-01-02T07:00:04.123-08:00"))
       );
-      Assert.assertEquals(
+      Assertions.assertEquals(
           DateTimes.of("2012-01-03T12:25:04.123-08:00"),
           gran.increment(DateTimes.of("2012-01-03T00:20:04.123-08:00"))
       );
-      Assert.assertEquals(
+      Assertions.assertEquals(
           DateTimes.of("2012-02-04T10:30:00.000-08:00"),
           gran.increment(DateTimes.of("2012-02-03T22:25:00.000-08:00"))
       );
@@ -758,19 +758,19 @@ public class QueryGranularityTest extends InitializedNullHandlingTest
           origin
       );
 
-      Assert.assertEquals(
+      Assertions.assertEquals(
           DateTimes.of("2012-01-01T17:05:04.123-08:00").getMillis(),
           gran.increment(DateTimes.of("2012-01-01T05:00:04.123-08:00").getMillis())
       );
-      Assert.assertEquals(
+      Assertions.assertEquals(
           DateTimes.of("2012-01-02T19:05:04.123-08:00").getMillis(),
           gran.increment(DateTimes.of("2012-01-02T07:00:04.123-08:00")).getMillis()
       );
-      Assert.assertEquals(
+      Assertions.assertEquals(
           DateTimes.of("2012-01-03T12:25:04.123-08:00").getMillis(),
           gran.increment(DateTimes.of("2012-01-03T00:20:04.123-08:00")).getMillis()
       );
-      Assert.assertEquals(
+      Assertions.assertEquals(
           DateTimes.of("2012-02-04T10:30:00.000-08:00").getMillis(),
           gran.increment(DateTimes.of("2012-02-03T22:25:00.000-08:00")).getMillis()
       );
@@ -786,7 +786,7 @@ public class QueryGranularityTest extends InitializedNullHandlingTest
         origin
     );
 
-    Assert.assertEquals(
+    Assertions.assertEquals(
         DateTimes.of("2012-01-01T05:00:04.123-08:00"),
         gran.toDateTime(DateTimes.of("2012-01-01T05:00:04.123-08:00").getMillis())
     );
@@ -822,18 +822,18 @@ public class QueryGranularityTest extends InitializedNullHandlingTest
 
     String json = "{ \"type\": \"period\", \"period\": \"P1D\" }";
     Granularity gran = mapper.readValue(json, Granularity.class);
-    Assert.assertEquals(new PeriodGranularity(new Period("P1D"), null, null), gran);
+    Assertions.assertEquals(new PeriodGranularity(new Period("P1D"), null, null), gran);
 
     // Nonstandard period
     json = "{ \"type\": \"period\", \"period\": \"P2D\" }";
     gran = mapper.readValue(json, Granularity.class);
-    Assert.assertEquals(new PeriodGranularity(new Period("P2D"), null, null), gran);
+    Assertions.assertEquals(new PeriodGranularity(new Period("P2D"), null, null), gran);
 
     // Set timeZone, origin
     json = "{ \"type\": \"period\", \"period\": \"P1D\","
            + "\"timeZone\": \"America/Los_Angeles\", \"origin\": \"1970-01-01T00:00:00Z\"}";
     gran = mapper.readValue(json, Granularity.class);
-    Assert.assertEquals(new PeriodGranularity(
+    Assertions.assertEquals(new PeriodGranularity(
         new Period("P1D"),
         DateTimes.EPOCH,
         DateTimes.inferTzFromString("America/Los_Angeles")
@@ -846,12 +846,12 @@ public class QueryGranularityTest extends InitializedNullHandlingTest
     );
 
     String jsonOut = mapper.writeValueAsString(expected);
-    Assert.assertEquals(expected, mapper.readValue(jsonOut, Granularity.class));
+    Assertions.assertEquals(expected, mapper.readValue(jsonOut, Granularity.class));
 
     String illegalJson = "{ \"type\": \"period\", \"period\": \"P0D\" }";
     try {
       mapper.readValue(illegalJson, Granularity.class);
-      Assert.fail();
+      Assertions.fail();
     }
     catch (JsonMappingException e) {
     }
@@ -864,19 +864,19 @@ public class QueryGranularityTest extends InitializedNullHandlingTest
 
     String json = "{ \"type\": \"duration\", \"duration\": \"3600000\" }";
     Granularity gran = mapper.readValue(json, Granularity.class);
-    Assert.assertEquals(new DurationGranularity(3600000, null), gran);
+    Assertions.assertEquals(new DurationGranularity(3600000, null), gran);
 
     json = "{ \"type\": \"duration\", \"duration\": \"5\", \"origin\": \"2012-09-01T00:00:00.002Z\" }";
     gran = mapper.readValue(json, Granularity.class);
-    Assert.assertEquals(new DurationGranularity(5, 2), gran);
+    Assertions.assertEquals(new DurationGranularity(5, 2), gran);
 
     DurationGranularity expected = new DurationGranularity(5, 2);
-    Assert.assertEquals(expected, mapper.readValue(mapper.writeValueAsString(expected), Granularity.class));
+    Assertions.assertEquals(expected, mapper.readValue(mapper.writeValueAsString(expected), Granularity.class));
 
     String illegalJson = "{ \"type\": \"duration\", \"duration\": \"0\" }";
     try {
       mapper.readValue(illegalJson, Granularity.class);
-      Assert.fail();
+      Assertions.fail();
     }
     catch (JsonMappingException e) {
     }
@@ -890,28 +890,28 @@ public class QueryGranularityTest extends InitializedNullHandlingTest
     for (GranularityType granularityType : GranularityType.values()) {
       final Granularity granularity = granularityType.getDefaultGranularity();
 
-      Assert.assertEquals(
+      Assertions.assertEquals(
           granularity,
           mapper.readValue("\"" + StringUtils.toUpperCase(granularityType.name()) + "\"", Granularity.class)
       );
 
-      Assert.assertEquals(
+      Assertions.assertEquals(
           granularity,
           mapper.readValue("\"" + StringUtils.toLowerCase(granularityType.name()) + "\"", Granularity.class)
       );
 
-      Assert.assertEquals(
+      Assertions.assertEquals(
           granularity,
           mapper.readValue(mapper.writeValueAsString(granularity), Granularity.class)
       );
 
       if (granularityType == GranularityType.ALL || granularityType == GranularityType.NONE) {
-        Assert.assertEquals(
+        Assertions.assertEquals(
             "{\"type\":\"" + StringUtils.toLowerCase(granularityType.name()) + "\"}",
             mapper.writeValueAsString(granularity)
         );
       } else {
-        Assert.assertEquals(
+        Assertions.assertEquals(
             "\"" + StringUtils.toUpperCase(granularityType.name()) + "\"",
             mapper.writeValueAsString(granularity)
         );
@@ -922,11 +922,11 @@ public class QueryGranularityTest extends InitializedNullHandlingTest
   @Test
   public void testMerge()
   {
-    Assert.assertNull(Granularity.mergeGranularities(null));
-    Assert.assertNull(Granularity.mergeGranularities(ImmutableList.of()));
-    Assert.assertNull(Granularity.mergeGranularities(Lists.newArrayList(null, Granularities.DAY)));
-    Assert.assertNull(Granularity.mergeGranularities(Lists.newArrayList(Granularities.DAY, null)));
-    Assert.assertNull(
+    Assertions.assertNull(Granularity.mergeGranularities(null));
+    Assertions.assertNull(Granularity.mergeGranularities(ImmutableList.of()));
+    Assertions.assertNull(Granularity.mergeGranularities(Lists.newArrayList(null, Granularities.DAY)));
+    Assertions.assertNull(Granularity.mergeGranularities(Lists.newArrayList(Granularities.DAY, null)));
+    Assertions.assertNull(
         Granularity.mergeGranularities(
             Lists.newArrayList(
                 Granularities.DAY,
@@ -935,11 +935,11 @@ public class QueryGranularityTest extends InitializedNullHandlingTest
             )
         )
     );
-    Assert.assertNull(
+    Assertions.assertNull(
         Granularity.mergeGranularities(ImmutableList.of(Granularities.ALL, Granularities.DAY))
     );
 
-    Assert.assertEquals(
+    Assertions.assertEquals(
         Granularities.ALL,
         Granularity.mergeGranularities(ImmutableList.of(Granularities.ALL, Granularities.ALL))
     );
@@ -947,28 +947,28 @@ public class QueryGranularityTest extends InitializedNullHandlingTest
 
   private void assertSameDateTime(List<DateTime> expected, Iterable<DateTime> actual)
   {
-    Assert.assertEquals(expected.size(), Iterables.size(actual));
+    Assertions.assertEquals(expected.size(), Iterables.size(actual));
     Iterator<DateTime> actualIter = actual.iterator();
     Iterator<DateTime> expectedIter = expected.iterator();
 
     while (actualIter.hasNext() && expectedIter.hasNext()) {
-      Assert.assertEquals(expectedIter.next(), actualIter.next());
+      Assertions.assertEquals(expectedIter.next(), actualIter.next());
     }
-    Assert.assertFalse("actualIter not exhausted!?", actualIter.hasNext());
-    Assert.assertFalse("expectedIter not exhausted!?", expectedIter.hasNext());
+    Assertions.assertFalse(actualIter.hasNext(), "actualIter not exhausted!?");
+    Assertions.assertFalse(expectedIter.hasNext(), "expectedIter not exhausted!?");
   }
 
   private void assertSameInterval(List<DateTime> expected, Iterable<Interval> actual)
   {
-    Assert.assertEquals(expected.size(), Iterables.size(actual));
+    Assertions.assertEquals(expected.size(), Iterables.size(actual));
     Iterator<Interval> actualIter = actual.iterator();
     Iterator<DateTime> expectedIter = expected.iterator();
 
     while (actualIter.hasNext() && expectedIter.hasNext()) {
-      Assert.assertEquals(expectedIter.next(), actualIter.next().getStart());
+      Assertions.assertEquals(expectedIter.next(), actualIter.next().getStart());
     }
-    Assert.assertFalse("actualIter not exhausted!?", actualIter.hasNext());
-    Assert.assertFalse("expectedIter not exhausted!?", expectedIter.hasNext());
+    Assertions.assertFalse(actualIter.hasNext(), "actualIter not exhausted!?");
+    Assertions.assertFalse(expectedIter.hasNext(), "expectedIter not exhausted!?");
   }
 
   @Test
@@ -1041,26 +1041,26 @@ public class QueryGranularityTest extends InitializedNullHandlingTest
     );
 
     ExpressionVirtualColumn column = Granularities.toVirtualColumn(hour, Granularities.GRANULARITY_VIRTUAL_COLUMN_NAME);
-    Assert.assertEquals("timestamp_floor(__time,'PT1H',null,'UTC')", column.getExpression());
+    Assertions.assertEquals("timestamp_floor(__time,'PT1H',null,'UTC')", column.getExpression());
     column = Granularities.toVirtualColumn(hourWithOrigin, Granularities.GRANULARITY_VIRTUAL_COLUMN_NAME);
-    Assert.assertEquals(
+    Assertions.assertEquals(
         "timestamp_floor(__time,'PT1H','2012-01-02T13:00:00.000Z','America/Los_Angeles')",
         column.getExpression()
     );
     column = Granularities.toVirtualColumn(hourWithTz, Granularities.GRANULARITY_VIRTUAL_COLUMN_NAME);
-    Assert.assertEquals("timestamp_floor(__time,'PT1H',null,'America/Los_Angeles')", column.getExpression());
+    Assertions.assertEquals("timestamp_floor(__time,'PT1H',null,'America/Los_Angeles')", column.getExpression());
     column = Granularities.toVirtualColumn(duration, Granularities.GRANULARITY_VIRTUAL_COLUMN_NAME);
-    Assert.assertEquals(ColumnHolder.TIME_COLUMN_NAME, column.getExpression());
+    Assertions.assertEquals(ColumnHolder.TIME_COLUMN_NAME, column.getExpression());
     column = Granularities.toVirtualColumn(Granularities.NONE, Granularities.GRANULARITY_VIRTUAL_COLUMN_NAME);
-    Assert.assertEquals(ColumnHolder.TIME_COLUMN_NAME, column.getExpression());
+    Assertions.assertEquals(ColumnHolder.TIME_COLUMN_NAME, column.getExpression());
     column = Granularities.toVirtualColumn(Granularities.ALL, Granularities.GRANULARITY_VIRTUAL_COLUMN_NAME);
-    Assert.assertNull(column);
+    Assertions.assertNull(column);
     column = Granularities.toVirtualColumn(Granularities.HOUR, Granularities.GRANULARITY_VIRTUAL_COLUMN_NAME);
-    Assert.assertEquals("timestamp_floor(__time,'PT1H',null,'UTC')", column.getExpression());
+    Assertions.assertEquals("timestamp_floor(__time,'PT1H',null,'UTC')", column.getExpression());
     column = Granularities.toVirtualColumn(Granularities.MINUTE, Granularities.GRANULARITY_VIRTUAL_COLUMN_NAME);
-    Assert.assertEquals("timestamp_floor(__time,'PT1M',null,'UTC')", column.getExpression());
+    Assertions.assertEquals("timestamp_floor(__time,'PT1M',null,'UTC')", column.getExpression());
     column = Granularities.toVirtualColumn(Granularities.FIFTEEN_MINUTE, Granularities.GRANULARITY_VIRTUAL_COLUMN_NAME);
-    Assert.assertEquals("timestamp_floor(__time,'PT15M',null,'UTC')", column.getExpression());
+    Assertions.assertEquals("timestamp_floor(__time,'PT15M',null,'UTC')", column.getExpression());
   }
 
   @Test
@@ -1110,25 +1110,25 @@ public class QueryGranularityTest extends InitializedNullHandlingTest
         ColumnType.LONG,
         TestExprMacroTable.INSTANCE
     );
-    Assert.assertEquals(Granularities.HOUR, Granularities.fromVirtualColumn(hourly));
-    Assert.assertEquals(Granularities.DAY, Granularities.fromVirtualColumn(day));
-    Assert.assertEquals(Granularities.HOUR, Granularities.fromVirtualColumn(hourlyNonstandardTime));
-    Assert.assertEquals(
+    Assertions.assertEquals(Granularities.HOUR, Granularities.fromVirtualColumn(hourly));
+    Assertions.assertEquals(Granularities.DAY, Granularities.fromVirtualColumn(day));
+    Assertions.assertEquals(Granularities.HOUR, Granularities.fromVirtualColumn(hourlyNonstandardTime));
+    Assertions.assertEquals(
         new PeriodGranularity(new Period("PT1H"), null, DateTimes.inferTzFromString("America/Los_Angeles")),
         Granularities.fromVirtualColumn(hourlyPacificTime)
     );
-    Assert.assertEquals(
+    Assertions.assertEquals(
         new PeriodGranularity(new Period("PT1H"), null, DateTimes.inferTzFromString("Asia/Kolkata")),
         Granularities.fromVirtualColumn(hourlyIndianTime)
     );
-    Assert.assertNull(Granularities.fromVirtualColumn(ceilHour));
-    Assert.assertEquals(Granularities.MINUTE, Granularities.fromVirtualColumn(floorWithExpression));
+    Assertions.assertNull(Granularities.fromVirtualColumn(ceilHour));
+    Assertions.assertEquals(Granularities.MINUTE, Granularities.fromVirtualColumn(floorWithExpression));
     final DateTime origin = DateTimes.of("2012-01-02T05:00:00.000-08:00");
     final DateTimeZone tz = DateTimes.inferTzFromString("America/Los_Angeles");
     final Granularity minuteWithTz = new PeriodGranularity(new Period("PT1M"), null, tz);
     final Granularity minuteWithOrigin = new PeriodGranularity(new Period("PT1M"), origin, tz);
-    Assert.assertEquals(minuteWithTz, Granularities.fromVirtualColumn(floorWithTimezone));
-    Assert.assertEquals(minuteWithOrigin, Granularities.fromVirtualColumn(floorWithOriginTimezone));
+    Assertions.assertEquals(minuteWithTz, Granularities.fromVirtualColumn(floorWithTimezone));
+    Assertions.assertEquals(minuteWithOrigin, Granularities.fromVirtualColumn(floorWithOriginTimezone));
   }
 
   @Test
@@ -1140,27 +1140,27 @@ public class QueryGranularityTest extends InitializedNullHandlingTest
         ColumnType.LONG,
         TestExprMacroTable.INSTANCE
     );
-    Assert.assertEquals(Granularities.ALL, Granularities.fromVirtualColumn(literalField));
+    Assertions.assertEquals(Granularities.ALL, Granularities.fromVirtualColumn(literalField));
   }
 
   private void assertBucketStart(final Granularity granularity, final DateTime in, final DateTime expectedInProperTz)
   {
-    Assert.assertEquals(
-        StringUtils.format("Granularity [%s] toDateTime(bucketStart(DateTime))", granularity),
+    Assertions.assertEquals(
         expectedInProperTz,
-        granularity.toDateTime(granularity.bucketStart(in).getMillis())
+        granularity.toDateTime(granularity.bucketStart(in).getMillis()),
+        StringUtils.format("Granularity [%s] toDateTime(bucketStart(DateTime))", granularity)
     );
 
-    Assert.assertEquals(
-        StringUtils.format("Granularity [%s] bucketStart(DateTime)", granularity),
+    Assertions.assertEquals(
         expectedInProperTz.withZone(in.getZone()),
-        granularity.bucketStart(in)
+        granularity.bucketStart(in),
+        StringUtils.format("Granularity [%s] bucketStart(DateTime)", granularity)
     );
 
-    Assert.assertEquals(
-        StringUtils.format("Granularity [%s] bucketStart(long)", granularity),
+    Assertions.assertEquals(
         expectedInProperTz.getMillis(),
-        granularity.bucketStart(in.getMillis())
+        granularity.bucketStart(in.getMillis()),
+        StringUtils.format("Granularity [%s] bucketStart(long)", granularity)
     );
   }
 }
diff --git a/processing/src/test/java/org/apache/druid/guice/ExtensionsLoaderTest.java b/processing/src/test/java/org/apache/druid/guice/ExtensionsLoaderTest.java
index 7ed12199362..ab72eb94a28 100644
--- a/processing/src/test/java/org/apache/druid/guice/ExtensionsLoaderTest.java
+++ b/processing/src/test/java/org/apache/druid/guice/ExtensionsLoaderTest.java
@@ -58,7 +58,7 @@ import java.util.jar.JarOutputStream;
 public class ExtensionsLoaderTest
 {
   @RegisterExtension
-  public final TemporaryFolderExtension temporaryFolder = new TemporaryFolderExtension();
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   private final ObjectMapper objectMapper = new ObjectMapper();
   private final Map<String, byte[]> jarFileContents = ImmutableMap.of(
diff --git a/processing/src/test/java/org/apache/druid/indexer/report/TaskReportSerdeTest.java b/processing/src/test/java/org/apache/druid/indexer/report/TaskReportSerdeTest.java
index f21e99650d4..67957e9a047 100644
--- a/processing/src/test/java/org/apache/druid/indexer/report/TaskReportSerdeTest.java
+++ b/processing/src/test/java/org/apache/druid/indexer/report/TaskReportSerdeTest.java
@@ -50,7 +50,7 @@ public class TaskReportSerdeTest
   private final ObjectMapper jsonMapper;
 
   @RegisterExtension
-  public final TemporaryFolderExtension temporaryFolder = new TemporaryFolderExtension();
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   public TaskReportSerdeTest()
   {
diff --git a/processing/src/test/java/org/apache/druid/io/LimitedOutputStreamTest.java b/processing/src/test/java/org/apache/druid/io/LimitedOutputStreamTest.java
index 9a4738f961f..5742636ad53 100644
--- a/processing/src/test/java/org/apache/druid/io/LimitedOutputStreamTest.java
+++ b/processing/src/test/java/org/apache/druid/io/LimitedOutputStreamTest.java
@@ -20,9 +20,6 @@
 package org.apache.druid.io;
 
 import org.apache.druid.java.util.common.StringUtils;
-import org.hamcrest.CoreMatchers;
-import org.hamcrest.MatcherAssert;
-import org.junit.internal.matchers.ThrowableMessageMatcher;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
 
@@ -44,7 +41,7 @@ public class LimitedOutputStreamTest
           () -> stream.write('b')
       );
 
-      MatcherAssert.assertThat(e, ThrowableMessageMatcher.hasMessage(CoreMatchers.equalTo("Limit[0] exceeded")));
+      Assertions.assertEquals("Limit[0] exceeded", e.getMessage());
     }
   }
 
@@ -62,7 +59,7 @@ public class LimitedOutputStreamTest
           () -> stream.write('d')
       );
 
-      MatcherAssert.assertThat(e, ThrowableMessageMatcher.hasMessage(CoreMatchers.equalTo("Limit[3] exceeded")));
+      Assertions.assertEquals("Limit[3] exceeded", e.getMessage());
     }
   }
 
@@ -76,7 +73,7 @@ public class LimitedOutputStreamTest
       stream.write(new byte[]{'b'});
       stream.write(new byte[]{'c'}, 0, 1);
 
-      MatcherAssert.assertThat(stream.toByteArray(), CoreMatchers.equalTo(new byte[]{'a', 'b', 'c'}));
+      Assertions.assertArrayEquals(new byte[]{'a', 'b', 'c'}, stream.toByteArray());
     }
 
     try (final DataOutputStream dos = new DataOutputStream(new ByteArrayOutputStream());
diff --git a/processing/src/test/java/org/apache/druid/java/util/common/ByteBufferUtilsTest.java b/processing/src/test/java/org/apache/druid/java/util/common/ByteBufferUtilsTest.java
index 37dda09c516..1609a9af672 100644
--- a/processing/src/test/java/org/apache/druid/java/util/common/ByteBufferUtilsTest.java
+++ b/processing/src/test/java/org/apache/druid/java/util/common/ByteBufferUtilsTest.java
@@ -22,9 +22,10 @@ package org.apache.druid.java.util.common;
 import com.google.common.collect.ImmutableList;
 import com.google.common.io.Files;
 import org.apache.druid.collections.ResourceHolder;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.BufferedOutputStream;
 import java.io.File;
@@ -32,7 +33,6 @@ import java.io.FileOutputStream;
 import java.io.OutputStream;
 import java.nio.ByteBuffer;
 import java.nio.MappedByteBuffer;
-import java.nio.file.Path;
 import java.util.Arrays;
 import java.util.Comparator;
 import java.util.List;
@@ -57,8 +57,8 @@ public class ByteBufferUtilsTest
       "fox"
   );
 
-  @TempDir
-  private Path tempDir;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   @Test
   public void testAllocateDirect()
@@ -75,7 +75,7 @@ public class ByteBufferUtilsTest
   @Test
   public void testUnmapDoesntCrashJVM() throws Exception
   {
-    final File file = tempDir.resolve("some_mmap_file").toFile();
+    final File file = temporaryFolder.newFile("some_mmap_file");
     try (final OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) {
       final byte[] data = new byte[4096];
       Arrays.fill(data, (byte) 0x5A);
diff --git a/processing/src/test/java/org/apache/druid/java/util/common/CompressionUtilsTest.java b/processing/src/test/java/org/apache/druid/java/util/common/CompressionUtilsTest.java
index 6fe76c33a3a..71348bbd575 100644
--- a/processing/src/test/java/org/apache/druid/java/util/common/CompressionUtilsTest.java
+++ b/processing/src/test/java/org/apache/druid/java/util/common/CompressionUtilsTest.java
@@ -108,7 +108,7 @@ public class CompressionUtilsTest
   }
 
   @RegisterExtension
-  public final TemporaryFolderExtension temporaryFolder = new TemporaryFolderExtension();
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
   private File testDir;
   private File testFile;
 
diff --git a/processing/src/test/java/org/apache/druid/java/util/common/FileUtilsTest.java b/processing/src/test/java/org/apache/druid/java/util/common/FileUtilsTest.java
index 190c58d1f42..ca23f891d33 100644
--- a/processing/src/test/java/org/apache/druid/java/util/common/FileUtilsTest.java
+++ b/processing/src/test/java/org/apache/druid/java/util/common/FileUtilsTest.java
@@ -20,11 +20,12 @@
 package org.apache.druid.java.util.common;
 
 import com.google.common.base.Predicates;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.hamcrest.CoreMatchers;
 import org.hamcrest.MatcherAssert;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.ByteArrayInputStream;
 import java.io.File;
@@ -36,13 +37,13 @@ import java.nio.file.Path;
 
 public class FileUtilsTest
 {
-  @TempDir
-  public File temporaryFolder;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   @Test
   public void testMap() throws IOException
   {
-    File dataFile = new File(temporaryFolder, "data");
+    File dataFile = new File(temporaryFolder.getRoot(), "data");
     long buffersMemoryBefore = BufferUtils.totalMemoryUsedByDirectAndMappedBuffers();
     try (RandomAccessFile raf = new RandomAccessFile(dataFile, "rw")) {
       raf.write(42);
@@ -59,61 +60,61 @@ public class FileUtilsTest
   public void testDeleteDirectoryAndEmptyAncestorsRemovesEmptyIntermediateDirs() throws IOException
   {
     // base/mid/leaf, where 'leaf' is the scratch dir and 'mid' is an intermediate dir mkdirp created along the way.
-    final File mid = new File(temporaryFolder, "mid");
+    final File mid = new File(temporaryFolder.getRoot(), "mid");
     final File leaf = new File(mid, "leaf");
     FileUtils.mkdirp(leaf);
 
-    FileUtils.deleteDirectoryAndEmptyAncestors(leaf, temporaryFolder);
+    FileUtils.deleteDirectoryAndEmptyAncestors(leaf, temporaryFolder.getRoot());
 
     Assertions.assertFalse(leaf.exists(), "leaf should be deleted");
     Assertions.assertFalse(mid.exists(), "empty intermediate dir should be deleted");
-    Assertions.assertTrue(temporaryFolder.exists(), "base (stopAt) must survive");
+    Assertions.assertTrue(temporaryFolder.getRoot().exists(), "base (stopAt) must survive");
   }
 
   @Test
   public void testDeleteDirectoryAndEmptyAncestorsStopsAtNonEmptyAncestor() throws IOException
   {
     // Shared intermediate dir with two sibling leaves; deleting one leaf must leave the shared parent (and sibling).
-    final File shared = new File(temporaryFolder, "shared");
+    final File shared = new File(temporaryFolder.getRoot(), "shared");
     final File leafA = new File(shared, "leafA");
     final File leafB = new File(shared, "leafB");
     FileUtils.mkdirp(leafA);
     FileUtils.mkdirp(leafB);
 
-    FileUtils.deleteDirectoryAndEmptyAncestors(leafA, temporaryFolder);
+    FileUtils.deleteDirectoryAndEmptyAncestors(leafA, temporaryFolder.getRoot());
 
     Assertions.assertFalse(leafA.exists(), "deleted leaf should be gone");
     Assertions.assertTrue(leafB.exists(), "sibling leaf must survive");
     Assertions.assertTrue(shared.exists(), "non-empty shared ancestor must survive");
 
     // Deleting the last sibling then reclaims the now-empty shared ancestor, stopping at base.
-    FileUtils.deleteDirectoryAndEmptyAncestors(leafB, temporaryFolder);
+    FileUtils.deleteDirectoryAndEmptyAncestors(leafB, temporaryFolder.getRoot());
     Assertions.assertFalse(shared.exists(), "shared ancestor should be reclaimed once empty");
-    Assertions.assertTrue(temporaryFolder.exists(), "base (stopAt) must survive");
+    Assertions.assertTrue(temporaryFolder.getRoot().exists(), "base (stopAt) must survive");
   }
 
   @Test
   public void testDeleteDirectoryAndEmptyAncestorsDeletesNonEmptyLeafButNeverStopAt() throws IOException
   {
     // The leaf itself is deleted recursively even when non-empty; a leaf directly under stopAt leaves stopAt intact.
-    final File leaf = new File(temporaryFolder, "leaf");
+    final File leaf = new File(temporaryFolder.getRoot(), "leaf");
     FileUtils.mkdirp(leaf);
     Assertions.assertTrue(new File(leaf, "buffer").createNewFile());
 
-    FileUtils.deleteDirectoryAndEmptyAncestors(leaf, temporaryFolder);
+    FileUtils.deleteDirectoryAndEmptyAncestors(leaf, temporaryFolder.getRoot());
 
     Assertions.assertFalse(leaf.exists(), "non-empty leaf should be deleted recursively");
-    Assertions.assertTrue(temporaryFolder.exists(), "base (stopAt) must survive");
+    Assertions.assertTrue(temporaryFolder.getRoot().exists(), "base (stopAt) must survive");
 
     // Passing stopAt itself is a no-op.
-    FileUtils.deleteDirectoryAndEmptyAncestors(temporaryFolder, temporaryFolder);
-    Assertions.assertTrue(temporaryFolder.exists(), "stopAt must never be deleted");
+    FileUtils.deleteDirectoryAndEmptyAncestors(temporaryFolder.getRoot(), temporaryFolder.getRoot());
+    Assertions.assertTrue(temporaryFolder.getRoot().exists(), "stopAt must never be deleted");
   }
 
   @Test
   public void testMapFileTooLarge() throws IOException
   {
-    File dataFile = new File(temporaryFolder, "data");
+    File dataFile = new File(temporaryFolder.getRoot(), "data");
     try (RandomAccessFile raf = new RandomAccessFile(dataFile, "rw")) {
       raf.write(42);
       raf.setLength(1 << 20); // 1 MiB
@@ -128,7 +129,7 @@ public class FileUtilsTest
   @Test
   public void testMapRandomAccessFileTooLarge() throws IOException
   {
-    File dataFile = new File(temporaryFolder, "data");
+    File dataFile = new File(temporaryFolder.getRoot(), "data");
     try (RandomAccessFile raf = new RandomAccessFile(dataFile, "rw")) {
       raf.write(42);
       raf.setLength(1 << 20); // 1 MiB
@@ -145,7 +146,7 @@ public class FileUtilsTest
   @Test
   public void testWriteAtomically() throws IOException
   {
-    final File tmpDir = temporaryFolder;
+    final File tmpDir = temporaryFolder.getRoot();
     final File tmpFile = new File(tmpDir, "file1");
     FileUtils.writeAtomically(tmpFile, out -> {
       out.write(StringUtils.toUtf8("foo"));
@@ -176,10 +177,10 @@ public class FileUtilsTest
   @Test
   public void testResolveFileWithinDirectory()
   {
-    final File resolved = FileUtils.resolveFileWithinDirectory(temporaryFolder, "nested/file");
+    final File resolved = FileUtils.resolveFileWithinDirectory(temporaryFolder.getRoot(), "nested/file");
 
     Assertions.assertEquals(
-        temporaryFolder.toPath().toAbsolutePath().resolve(Path.of("nested", "file")).normalize(),
+        temporaryFolder.getRoot().toPath().toAbsolutePath().resolve(Path.of("nested", "file")).normalize(),
         resolved.toPath()
     );
   }
@@ -189,7 +190,7 @@ public class FileUtilsTest
   {
     Assertions.assertThrows(
         IAE.class,
-        () -> FileUtils.resolveFileWithinDirectory(temporaryFolder, "../outside")
+        () -> FileUtils.resolveFileWithinDirectory(temporaryFolder.getRoot(), "../outside")
     );
   }
 
@@ -199,8 +200,8 @@ public class FileUtilsTest
     Assertions.assertThrows(
         IAE.class,
         () -> FileUtils.resolveFileWithinDirectory(
-            temporaryFolder,
-            temporaryFolder.toPath().resolve("inside").toAbsolutePath().toString()
+            temporaryFolder.getRoot(),
+            temporaryFolder.getRoot().toPath().resolve("inside").toAbsolutePath().toString()
         )
     );
   }
@@ -210,11 +211,11 @@ public class FileUtilsTest
   {
     final IAE exception = Assertions.assertThrows(
         IAE.class,
-        () -> FileUtils.resolveFileWithinDirectory(temporaryFolder, "invalid\0path")
+        () -> FileUtils.resolveFileWithinDirectory(temporaryFolder.getRoot(), "invalid\0path")
     );
 
     Assertions.assertEquals(
-        StringUtils.format("Path[%s] is not within directory[%s]", "invalid\0path", temporaryFolder),
+        StringUtils.format("Path[%s] is not within directory[%s]", "invalid\0path", temporaryFolder.getRoot()),
         exception.getMessage()
     );
     Assertions.assertInstanceOf(InvalidPathException.class, exception.getCause());
@@ -238,7 +239,7 @@ public class FileUtilsTest
   @Test
   public void testCreateTempDirInLocation() throws IOException
   {
-    final File baseDir = temporaryFolder;
+    final File baseDir = temporaryFolder.getRoot();
     File tmp = FileUtils.createTempDirInLocation(baseDir.toPath(), null);
     Assertions.assertTrue(tmp.getName().startsWith("druid"));
     Assertions.assertEquals(
@@ -286,7 +287,7 @@ public class FileUtilsTest
   @Test
   public void testMkdirp() throws IOException
   {
-    final File tmpDir = temporaryFolder;
+    final File tmpDir = temporaryFolder.getRoot();
     final File testDirectory = new File(tmpDir, "test");
 
     FileUtils.mkdirp(testDirectory);
@@ -299,7 +300,7 @@ public class FileUtilsTest
   @Test
   public void testMkdirpCannotCreateOverExistingFile() throws IOException
   {
-    final File tmpFile = File.createTempFile("tmp", null, temporaryFolder);
+    final File tmpFile = File.createTempFile("tmp", null, temporaryFolder.getRoot());
 
     Throwable t = Assertions.assertThrows(IOException.class, () -> FileUtils.mkdirp(tmpFile));
     MatcherAssert.assertThat(
@@ -311,7 +312,7 @@ public class FileUtilsTest
   @Test
   public void testMkdirpCannotCreateInNonWritableDirectory() throws IOException
   {
-    final File tmpDir = temporaryFolder;
+    final File tmpDir = temporaryFolder.getRoot();
     final File testDirectory = new File(tmpDir, "test");
     tmpDir.setWritable(false);
     final IOException e = Assertions.assertThrows(IOException.class, () -> FileUtils.mkdirp(testDirectory));
@@ -330,7 +331,7 @@ public class FileUtilsTest
   @Test
   public void testCopyLarge() throws IOException
   {
-    final File dstDirectory = temporaryFolder;
+    final File dstDirectory = temporaryFolder.getRoot();
     final File dstFile = new File(dstDirectory, "dst");
     final String data = "test data to write";
 
@@ -352,8 +353,8 @@ public class FileUtilsTest
   {
     // Will be a LINK.
 
-    final File fromFile = File.createTempFile("from", null, temporaryFolder);
-    final File toDir = new File(temporaryFolder, "toDir");
+    final File fromFile = File.createTempFile("from", null, temporaryFolder.getRoot());
+    final File toDir = new File(temporaryFolder.getRoot(), "toDir");
     toDir.mkdir();
     final File toFile = new File(toDir, "toFile");
 
@@ -374,8 +375,8 @@ public class FileUtilsTest
   {
     // Will be a COPY, because the destination file already exists and therefore Files.createLink fails.
 
-    final File fromFile = File.createTempFile("from", null, temporaryFolder);
-    final File toFile = File.createTempFile("dst", null, temporaryFolder);
+    final File fromFile = File.createTempFile("from", null, temporaryFolder.getRoot());
+    final File toFile = File.createTempFile("dst", null, temporaryFolder.getRoot());
 
     Files.write(fromFile.toPath(), StringUtils.toUtf8("foo"));
     final FileUtils.LinkOrCopyResult linkOrCopyResult = FileUtils.linkOrCopy(fromFile, toFile);
diff --git a/processing/src/test/java/org/apache/druid/java/util/common/io/NativeIOTest.java b/processing/src/test/java/org/apache/druid/java/util/common/io/NativeIOTest.java
index f7bd511192c..d7049f5a5d6 100644
--- a/processing/src/test/java/org/apache/druid/java/util/common/io/NativeIOTest.java
+++ b/processing/src/test/java/org/apache/druid/java/util/common/io/NativeIOTest.java
@@ -19,27 +19,26 @@
 
 package org.apache.druid.java.util.common.io;
 
-import org.apache.druid.java.util.common.FileUtils;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.IOException;
 import java.nio.file.Files;
-import java.nio.file.Path;
 import java.util.Arrays;
 
 public class NativeIOTest
 {
-  @TempDir
-  Path tempDir;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   @Test
   public void testChunkedCopy() throws Exception
   {
-    File f = Files.createTempFile(tempDir, "junit", null).toFile();
+    File f = temporaryFolder.newFile();
     byte[] bytes = new byte[]{(byte) 0x8, (byte) 0x9};
 
     ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
@@ -52,7 +51,7 @@ public class NativeIOTest
   @Test
   public void testException() throws Exception
   {
-    File dir = FileUtils.createTempDirInLocation(tempDir, "folder");
+    File dir = temporaryFolder.newFolder("folder");
     Assertions.assertThrows(IOException.class, () -> NativeIO.chunkedCopy(null, dir));
   }
 
@@ -62,7 +61,7 @@ public class NativeIOTest
     boolean possible = NativeIO.isFadvisePossible();
 
     NativeIO.setFadvisePossible(false);
-    File f = Files.createTempFile(tempDir, "junit", null).toFile();
+    File f = temporaryFolder.newFile();
     byte[] bytes = new byte[]{(byte) 0x8, (byte) 0x9};
 
     ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
@@ -80,7 +79,7 @@ public class NativeIOTest
     boolean possible = NativeIO.isSyncFileRangePossible();
 
     NativeIO.setSyncFileRangePossible(false);
-    File f = Files.createTempFile(tempDir, "junit", null).toFile();
+    File f = temporaryFolder.newFile();
     byte[] bytes = new byte[]{(byte) 0x8, (byte) 0x9};
 
     ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
diff --git a/processing/src/test/java/org/apache/druid/java/util/common/io/smoosh/SmooshedFileMapperTest.java b/processing/src/test/java/org/apache/druid/java/util/common/io/smoosh/SmooshedFileMapperTest.java
index 69b20c0b897..ce8ec246625 100644
--- a/processing/src/test/java/org/apache/druid/java/util/common/io/smoosh/SmooshedFileMapperTest.java
+++ b/processing/src/test/java/org/apache/druid/java/util/common/io/smoosh/SmooshedFileMapperTest.java
@@ -27,9 +27,10 @@ import org.apache.druid.java.util.common.BufferUtils;
 import org.apache.druid.java.util.common.ISE;
 import org.apache.druid.java.util.common.StringUtils;
 import org.apache.druid.segment.file.SegmentFileChannel;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.File;
 import java.io.IOException;
@@ -41,18 +42,17 @@ import java.util.Arrays;
  */
 public class SmooshedFileMapperTest
 {
-  @TempDir
-  public File folder;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   @Test
   public void testSanity() throws Exception
   {
-    File baseDir = new File(folder, "base");
-    baseDir.mkdir();
+    File baseDir = temporaryFolder.newFolder("base");
 
     try (FileSmoosher smoosher = new FileSmoosher(baseDir, 21)) {
       for (int i = 0; i < 20; ++i) {
-        File tmpFile = new File(folder, StringUtils.format("smoosh-%s.bin", i));
+        File tmpFile = temporaryFolder.newFile(StringUtils.format("smoosh-%s.bin", i));
         Files.write(Ints.toByteArray(i), tmpFile);
         smoosher.add(StringUtils.format("%d", i), tmpFile);
       }
@@ -63,8 +63,7 @@ public class SmooshedFileMapperTest
   @Test
   public void testWhenFirstWriterClosedInTheMiddle() throws Exception
   {
-    File baseDir = new File(folder, "base");
-    baseDir.mkdir();
+    File baseDir = temporaryFolder.newFolder("base");
 
     try (FileSmoosher smoosher = new FileSmoosher(baseDir, 21)) {
       final SegmentFileChannel writer = smoosher.addWithChannel(StringUtils.format("%d", 19), 4);
@@ -86,8 +85,7 @@ public class SmooshedFileMapperTest
   @Test
   public void testColumnSerializedSizeExceedsMaximum() throws Exception
   {
-    File baseDir = new File(folder, "base");
-    baseDir.mkdir();
+    File baseDir = temporaryFolder.newFolder("base");
     try (FileSmoosher smoosher = new FileSmoosher(baseDir, 5)) {
       DruidExceptionMatcher.assertThat(
           Assertions.assertThrows(
@@ -103,8 +101,7 @@ public class SmooshedFileMapperTest
   @Test
   public void testExceptionForUnClosedFiles() throws Exception
   {
-    File baseDir = new File(folder, "base");
-    baseDir.mkdir();
+    File baseDir = temporaryFolder.newFolder("base");
     Assertions.assertThrows(ISE.class, () -> {
       try (FileSmoosher smoosher = new FileSmoosher(baseDir, 21)) {
         for (int i = 0; i < 19; ++i) {
@@ -118,8 +115,7 @@ public class SmooshedFileMapperTest
   @Test
   public void testWhenFirstWriterClosedAtTheEnd() throws Exception
   {
-    File baseDir = new File(folder, "base");
-    baseDir.mkdir();
+    File baseDir = temporaryFolder.newFolder("base");
 
     try (FileSmoosher smoosher = new FileSmoosher(baseDir, 21)) {
       final SegmentFileChannel writer = smoosher.addWithChannel(StringUtils.format("%d", 19), 4);
@@ -140,8 +136,7 @@ public class SmooshedFileMapperTest
   public void testWhenWithPathyLookingFileNames() throws Exception
   {
     String prefix = "foo/bar/";
-    File baseDir = new File(folder, "base");
-    baseDir.mkdir();
+    File baseDir = temporaryFolder.newFolder("base");
 
     try (FileSmoosher smoosher = new FileSmoosher(baseDir, 21)) {
       final SegmentFileChannel writer = smoosher.addWithChannel(StringUtils.format("%s%d", prefix, 19), 4);
@@ -161,8 +156,7 @@ public class SmooshedFileMapperTest
   @Test
   public void testBehaviorWhenReportedSizesLargeAndExceptionIgnored() throws Exception
   {
-    File baseDir = new File(folder, "base");
-    baseDir.mkdir();
+    File baseDir = temporaryFolder.newFolder("base");
 
     try (FileSmoosher smoosher = new FileSmoosher(baseDir, 21)) {
       for (int i = 0; i < 20; ++i) {
@@ -202,8 +196,7 @@ public class SmooshedFileMapperTest
   @Test
   public void testBehaviorWhenReportedSizesSmall() throws Exception
   {
-    File baseDir = new File(folder, "base");
-    baseDir.mkdir();
+    File baseDir = temporaryFolder.newFolder("base");
 
     try (FileSmoosher smoosher = new FileSmoosher(baseDir, 21)) {
       boolean exceptionThrown = false;
@@ -225,12 +218,11 @@ public class SmooshedFileMapperTest
   @Test
   public void testDeterministicFileUnmapping() throws IOException
   {
-    File baseDir = new File(folder, "base");
-    baseDir.mkdir();
+    File baseDir = temporaryFolder.newFolder("base");
 
     long totalMemoryUsedBeforeAddingFile = BufferUtils.totalMemoryUsedByDirectAndMappedBuffers();
     try (FileSmoosher smoosher = new FileSmoosher(baseDir)) {
-      File dataFile = new File(folder, "data.bin");
+      File dataFile = temporaryFolder.newFile("data.bin");
       try (RandomAccessFile raf = new RandomAccessFile(dataFile, "rw")) {
         raf.setLength(1 << 20); // 1 MiB
       }
diff --git a/processing/src/test/java/org/apache/druid/java/util/emitter/core/HttpPostEmitterLoggerStressTest.java b/processing/src/test/java/org/apache/druid/java/util/emitter/core/HttpPostEmitterLoggerStressTest.java
index 1e0cc662c88..e00769aa009 100644
--- a/processing/src/test/java/org/apache/druid/java/util/emitter/core/HttpPostEmitterLoggerStressTest.java
+++ b/processing/src/test/java/org/apache/druid/java/util/emitter/core/HttpPostEmitterLoggerStressTest.java
@@ -21,16 +21,15 @@ package org.apache.druid.java.util.emitter.core;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.druid.java.util.emitter.service.ServiceMetricEvent;
-import org.apache.druid.testing.junit.LoggerCaptureRule;
+import org.apache.druid.testing.junit.LoggerCaptureExtension;
 import org.apache.logging.log4j.Level;
 import org.asynchttpclient.ListenableFuture;
 import org.asynchttpclient.Request;
 import org.asynchttpclient.Response;
-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 org.junit.jupiter.api.Timeout;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.IOException;
 import java.util.Locale;
@@ -39,22 +38,11 @@ import java.util.concurrent.TimeoutException;
 
 public class HttpPostEmitterLoggerStressTest
 {
-  public LoggerCaptureRule logCapture = new LoggerCaptureRule(HttpPostEmitter.class);
+  @RegisterExtension
+  public final LoggerCaptureExtension logCapture = new LoggerCaptureExtension(HttpPostEmitter.class);
 
   private final MockHttpClient httpClient = new MockHttpClient();
 
-  @BeforeEach
-  public void setUpLogCapture()
-  {
-    logCapture.before();
-  }
-
-  @AfterEach
-  public void tearDownLogCapture()
-  {
-    logCapture.after();
-  }
-
   @Test
   @Timeout(value = 20_000L, unit = TimeUnit.MILLISECONDS)
   public void testBurstFollowedByQuietPeriod() throws InterruptedException, IOException
diff --git a/processing/src/test/java/org/apache/druid/java/util/emitter/core/LoggingEmitterTest.java b/processing/src/test/java/org/apache/druid/java/util/emitter/core/LoggingEmitterTest.java
index 53384f8270e..3b1ddcf3951 100644
--- a/processing/src/test/java/org/apache/druid/java/util/emitter/core/LoggingEmitterTest.java
+++ b/processing/src/test/java/org/apache/druid/java/util/emitter/core/LoggingEmitterTest.java
@@ -24,11 +24,12 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.druid.java.util.common.logger.Logger;
 import org.apache.druid.java.util.emitter.service.ServiceMetricEvent;
 import org.apache.druid.java.util.emitter.service.UnitEvent;
+import org.apache.druid.testing.TemporaryFolderExtension;
 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 org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.File;
 import java.io.IOException;
@@ -41,8 +42,8 @@ import java.util.List;
 
 public class LoggingEmitterTest
 {
-  @TempDir
-  public File tempFolder;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   private List<Object> serializedObjects;
   private ObjectMapper trackingMapper;
@@ -203,7 +204,7 @@ public class LoggingEmitterTest
 
   private File createAllowlistFile(String jsonContent) throws IOException
   {
-    final File file = new File(tempFolder, "allowedMetrics.json");
+    final File file = temporaryFolder.newFile("allowedMetrics.json");
     try (Writer writer = new OutputStreamWriter(Files.newOutputStream(file.toPath()), StandardCharsets.UTF_8)) {
       writer.write(jsonContent);
     }
diff --git a/processing/src/test/java/org/apache/druid/java/util/metrics/CgroupCpuMonitorTest.java b/processing/src/test/java/org/apache/druid/java/util/metrics/CgroupCpuMonitorTest.java
index 55e6b519144..217a380f0a5 100644
--- a/processing/src/test/java/org/apache/druid/java/util/metrics/CgroupCpuMonitorTest.java
+++ b/processing/src/test/java/org/apache/druid/java/util/metrics/CgroupCpuMonitorTest.java
@@ -27,23 +27,23 @@ import org.apache.druid.java.util.metrics.cgroups.CgroupVersion;
 import org.apache.druid.java.util.metrics.cgroups.ProcCgroupDiscoverer;
 import org.apache.druid.java.util.metrics.cgroups.ProcSelfCgroupDiscoverer;
 import org.apache.druid.java.util.metrics.cgroups.TestUtils;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.File;
 import java.io.IOException;
 import java.net.URISyntaxException;
-import java.nio.file.Path;
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
 
 public class CgroupCpuMonitorTest
 {
-  @TempDir
-  private Path tempDir;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
   private File procDir;
   private File cgroupDir;
   private File statFile;
@@ -52,8 +52,8 @@ public class CgroupCpuMonitorTest
   @BeforeEach
   public void setUp() throws IOException
   {
-    cgroupDir = FileUtils.createTempDirInLocation(tempDir, "cgroupDir");
-    procDir = FileUtils.createTempDirInLocation(tempDir, "procDir");
+    cgroupDir = temporaryFolder.newFolder("cgroupDir");
+    procDir = temporaryFolder.newFolder("procDir");
     discoverer = new ProcCgroupDiscoverer(procDir.toPath());
     TestUtils.setUpCgroups(procDir, cgroupDir);
     final File cpuDir = new File(
@@ -119,8 +119,8 @@ public class CgroupCpuMonitorTest
   public void testCgroupsV2Detection() throws IOException, URISyntaxException
   {
     // Set up cgroups v2 structure
-    File cgroupV2Dir = FileUtils.createTempDirInLocation(tempDir, "cgroupV2Dir");
-    File procV2Dir = FileUtils.createTempDirInLocation(tempDir, "procV2Dir");
+    File cgroupV2Dir = temporaryFolder.newFolder("cgroupV2Dir");
+    File procV2Dir = temporaryFolder.newFolder("procV2Dir");
     TestUtils.setUpCgroupsV2(procV2Dir, cgroupV2Dir);
 
 
diff --git a/processing/src/test/java/org/apache/druid/java/util/metrics/CgroupCpuSetMonitorTest.java b/processing/src/test/java/org/apache/druid/java/util/metrics/CgroupCpuSetMonitorTest.java
index 4809519743b..3e821fd7db1 100644
--- a/processing/src/test/java/org/apache/druid/java/util/metrics/CgroupCpuSetMonitorTest.java
+++ b/processing/src/test/java/org/apache/druid/java/util/metrics/CgroupCpuSetMonitorTest.java
@@ -25,22 +25,22 @@ import org.apache.druid.java.util.metrics.cgroups.CgroupVersion;
 import org.apache.druid.java.util.metrics.cgroups.ProcCgroupDiscoverer;
 import org.apache.druid.java.util.metrics.cgroups.ProcSelfCgroupDiscoverer;
 import org.apache.druid.java.util.metrics.cgroups.TestUtils;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.File;
 import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
-import java.nio.file.Path;
 import java.nio.file.Paths;
 
 public class CgroupCpuSetMonitorTest
 {
-  @TempDir
-  private Path tempDir;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
   private File procDir;
   private File cgroupDir;
   private CgroupDiscoverer discoverer;
@@ -48,8 +48,8 @@ public class CgroupCpuSetMonitorTest
   @BeforeEach
   public void setUp() throws IOException
   {
-    cgroupDir = FileUtils.createTempDirInLocation(tempDir, "cgroup");
-    procDir = FileUtils.createTempDirInLocation(tempDir, "proc");
+    cgroupDir = temporaryFolder.newFolder("cgroup");
+    procDir = temporaryFolder.newFolder("proc");
     discoverer = new ProcCgroupDiscoverer(procDir.toPath());
     TestUtils.setUpCgroups(procDir, cgroupDir);
     final File cpusetDir = new File(
@@ -83,8 +83,8 @@ public class CgroupCpuSetMonitorTest
   public void testCgroupsV2DetectionInConstructor() throws IOException
   {
     // Set up cgroups v2 structure
-    File cgroupV2Dir = FileUtils.createTempDirInLocation(tempDir, "cgroupV2");
-    File procV2Dir = FileUtils.createTempDirInLocation(tempDir, "procV2");
+    File cgroupV2Dir = temporaryFolder.newFolder("cgroupV2");
+    File procV2Dir = temporaryFolder.newFolder("procV2");
     TestUtils.setUpCgroupsV2(procV2Dir, cgroupV2Dir);
     
     // Create v2 cpuset files in unified hierarchy
diff --git a/processing/src/test/java/org/apache/druid/java/util/metrics/CgroupDiskMonitorTest.java b/processing/src/test/java/org/apache/druid/java/util/metrics/CgroupDiskMonitorTest.java
index ff3e9ed4d38..4a8fa35f4c2 100644
--- a/processing/src/test/java/org/apache/druid/java/util/metrics/CgroupDiskMonitorTest.java
+++ b/processing/src/test/java/org/apache/druid/java/util/metrics/CgroupDiskMonitorTest.java
@@ -23,19 +23,19 @@ import org.apache.druid.java.util.common.FileUtils;
 import org.apache.druid.java.util.metrics.cgroups.CgroupDiscoverer;
 import org.apache.druid.java.util.metrics.cgroups.ProcCgroupDiscoverer;
 import org.apache.druid.java.util.metrics.cgroups.TestUtils;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.File;
 import java.io.IOException;
-import java.nio.file.Path;
 
 public class CgroupDiskMonitorTest
 {
-  @TempDir
-  Path tempDir;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
   private File procDir;
   private File cgroupDir;
   private File servicedFile;
@@ -45,8 +45,8 @@ public class CgroupDiskMonitorTest
   @BeforeEach
   public void setUp() throws IOException
   {
-    cgroupDir = FileUtils.createTempDirInLocation(tempDir, "cgroupDir");
-    procDir = FileUtils.createTempDirInLocation(tempDir, "procDir");
+    cgroupDir = temporaryFolder.newFolder("cgroupDir");
+    procDir = temporaryFolder.newFolder("procDir");
     discoverer = new ProcCgroupDiscoverer(procDir.toPath());
     TestUtils.setUpCgroups(procDir, cgroupDir);
     final File blkioDir = new File(
diff --git a/processing/src/test/java/org/apache/druid/java/util/metrics/CgroupMemoryMonitorTest.java b/processing/src/test/java/org/apache/druid/java/util/metrics/CgroupMemoryMonitorTest.java
index e9eb9f2cb6d..8eb7b7c4bb1 100644
--- a/processing/src/test/java/org/apache/druid/java/util/metrics/CgroupMemoryMonitorTest.java
+++ b/processing/src/test/java/org/apache/druid/java/util/metrics/CgroupMemoryMonitorTest.java
@@ -23,19 +23,19 @@ import org.apache.druid.java.util.common.FileUtils;
 import org.apache.druid.java.util.metrics.cgroups.CgroupDiscoverer;
 import org.apache.druid.java.util.metrics.cgroups.ProcCgroupDiscoverer;
 import org.apache.druid.java.util.metrics.cgroups.TestUtils;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.File;
 import java.io.IOException;
-import java.nio.file.Path;
 
 public class CgroupMemoryMonitorTest
 {
-  @TempDir
-  Path tempDir;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
   private File procDir;
   private File cgroupDir;
   private CgroupDiscoverer discoverer;
@@ -43,8 +43,8 @@ public class CgroupMemoryMonitorTest
   @BeforeEach
   public void setUp() throws IOException
   {
-    cgroupDir = FileUtils.createTempDirInLocation(tempDir, "cgroupDir");
-    procDir = FileUtils.createTempDirInLocation(tempDir, "procDir");
+    cgroupDir = temporaryFolder.newFolder("cgroupDir");
+    procDir = temporaryFolder.newFolder("procDir");
     discoverer = new ProcCgroupDiscoverer(procDir.toPath());
     TestUtils.setUpCgroups(procDir, cgroupDir);
     final File memoryDir = new File(
diff --git a/processing/src/test/java/org/apache/druid/java/util/metrics/CgroupV2CpuMonitorTest.java b/processing/src/test/java/org/apache/druid/java/util/metrics/CgroupV2CpuMonitorTest.java
index 02df2cd823d..7efa1f29a32 100644
--- a/processing/src/test/java/org/apache/druid/java/util/metrics/CgroupV2CpuMonitorTest.java
+++ b/processing/src/test/java/org/apache/druid/java/util/metrics/CgroupV2CpuMonitorTest.java
@@ -20,24 +20,23 @@
 package org.apache.druid.java.util.metrics;
 
 import com.google.common.collect.ImmutableSet;
-import org.apache.druid.java.util.common.FileUtils;
 import org.apache.druid.java.util.metrics.cgroups.CgroupDiscoverer;
 import org.apache.druid.java.util.metrics.cgroups.ProcCgroupV2Discoverer;
 import org.apache.druid.java.util.metrics.cgroups.TestUtils;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.File;
 import java.io.IOException;
-import java.nio.file.Path;
 import java.util.stream.Collectors;
 
 public class CgroupV2CpuMonitorTest
 {
-  @TempDir
-  Path tempDir;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
   private File procDir;
   private File cgroupDir;
   private File statFile;
@@ -46,8 +45,8 @@ public class CgroupV2CpuMonitorTest
   @BeforeEach
   public void setUp() throws IOException
   {
-    cgroupDir = FileUtils.createTempDirInLocation(tempDir, "cgroupDir");
-    procDir = FileUtils.createTempDirInLocation(tempDir, "procDir");
+    cgroupDir = temporaryFolder.newFolder("cgroupDir");
+    procDir = temporaryFolder.newFolder("procDir");
     discoverer = new ProcCgroupV2Discoverer(procDir.toPath());
     TestUtils.setUpCgroupsV2(procDir, cgroupDir);
 
diff --git a/processing/src/test/java/org/apache/druid/java/util/metrics/CgroupV2DiskMonitorTest.java b/processing/src/test/java/org/apache/druid/java/util/metrics/CgroupV2DiskMonitorTest.java
index c4521774593..e4f048982ac 100644
--- a/processing/src/test/java/org/apache/druid/java/util/metrics/CgroupV2DiskMonitorTest.java
+++ b/processing/src/test/java/org/apache/druid/java/util/metrics/CgroupV2DiskMonitorTest.java
@@ -19,23 +19,22 @@
 
 package org.apache.druid.java.util.metrics;
 
-import org.apache.druid.java.util.common.FileUtils;
 import org.apache.druid.java.util.metrics.cgroups.CgroupDiscoverer;
 import org.apache.druid.java.util.metrics.cgroups.ProcCgroupV2Discoverer;
 import org.apache.druid.java.util.metrics.cgroups.TestUtils;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.File;
 import java.io.IOException;
-import java.nio.file.Path;
 
 public class CgroupV2DiskMonitorTest
 {
-  @TempDir
-  Path tempDir;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
   private File procDir;
   private File cgroupDir;
   private File statFile;
@@ -44,8 +43,8 @@ public class CgroupV2DiskMonitorTest
   @BeforeEach
   public void setUp() throws IOException
   {
-    cgroupDir = FileUtils.createTempDirInLocation(tempDir, "cgroupDir");
-    procDir = FileUtils.createTempDirInLocation(tempDir, "procDir");
+    cgroupDir = temporaryFolder.newFolder("cgroupDir");
+    procDir = temporaryFolder.newFolder("procDir");
     discoverer = new ProcCgroupV2Discoverer(procDir.toPath());
     TestUtils.setUpCgroupsV2(procDir, cgroupDir);
 
diff --git a/processing/src/test/java/org/apache/druid/java/util/metrics/CgroupV2MemoryMonitorTest.java b/processing/src/test/java/org/apache/druid/java/util/metrics/CgroupV2MemoryMonitorTest.java
index 53349a61779..369eaf77388 100644
--- a/processing/src/test/java/org/apache/druid/java/util/metrics/CgroupV2MemoryMonitorTest.java
+++ b/processing/src/test/java/org/apache/druid/java/util/metrics/CgroupV2MemoryMonitorTest.java
@@ -19,25 +19,24 @@
 
 package org.apache.druid.java.util.metrics;
 
-import org.apache.druid.java.util.common.FileUtils;
 import org.apache.druid.java.util.emitter.core.Event;
 import org.apache.druid.java.util.metrics.cgroups.CgroupDiscoverer;
 import org.apache.druid.java.util.metrics.cgroups.ProcCgroupV2Discoverer;
 import org.apache.druid.java.util.metrics.cgroups.TestUtils;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.File;
 import java.io.IOException;
-import java.nio.file.Path;
 import java.util.List;
 
 public class CgroupV2MemoryMonitorTest
 {
-  @TempDir
-  Path tempDir;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
   private File procDir;
   private File cgroupDir;
   private CgroupDiscoverer discoverer;
@@ -45,8 +44,8 @@ public class CgroupV2MemoryMonitorTest
   @BeforeEach
   public void setUp() throws IOException
   {
-    cgroupDir = FileUtils.createTempDirInLocation(tempDir, "cgroupDir");
-    procDir = FileUtils.createTempDirInLocation(tempDir, "procDir");
+    cgroupDir = temporaryFolder.newFolder("cgroupDir");
+    procDir = temporaryFolder.newFolder("procDir");
     discoverer = new ProcCgroupV2Discoverer(procDir.toPath());
     TestUtils.setUpCgroupsV2(procDir, cgroupDir);
 
diff --git a/processing/src/test/java/org/apache/druid/java/util/metrics/CpuAcctDeltaMonitorTest.java b/processing/src/test/java/org/apache/druid/java/util/metrics/CpuAcctDeltaMonitorTest.java
index 04ea0c5f892..5d9b9f995d1 100644
--- a/processing/src/test/java/org/apache/druid/java/util/metrics/CpuAcctDeltaMonitorTest.java
+++ b/processing/src/test/java/org/apache/druid/java/util/metrics/CpuAcctDeltaMonitorTest.java
@@ -26,10 +26,11 @@ import org.apache.druid.java.util.metrics.cgroups.CgroupVersion;
 import org.apache.druid.java.util.metrics.cgroups.Cpu;
 import org.apache.druid.java.util.metrics.cgroups.CpuSet;
 import org.apache.druid.java.util.metrics.cgroups.TestUtils;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.File;
 import java.io.FileOutputStream;
@@ -38,8 +39,8 @@ import java.nio.file.Path;
 
 public class CpuAcctDeltaMonitorTest
 {
-  @TempDir
-  private Path tempDir;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
   private File procDir;
   private File cgroupDir;
   private File cpuacctDir;
@@ -47,8 +48,8 @@ public class CpuAcctDeltaMonitorTest
   @BeforeEach
   public void setUp() throws IOException
   {
-    cgroupDir = FileUtils.createTempDirInLocation(tempDir, "cgroup");
-    procDir = FileUtils.createTempDirInLocation(tempDir, "proc");
+    cgroupDir = temporaryFolder.newFolder("cgroup");
+    procDir = temporaryFolder.newFolder("proc");
     TestUtils.setUpCgroups(procDir, cgroupDir);
     cpuacctDir = new File(
         cgroupDir,
diff --git a/processing/src/test/java/org/apache/druid/java/util/metrics/ProcFsReaderTest.java b/processing/src/test/java/org/apache/druid/java/util/metrics/ProcFsReaderTest.java
index bfcf6c3d9cf..01c11b782e5 100644
--- a/processing/src/test/java/org/apache/druid/java/util/metrics/ProcFsReaderTest.java
+++ b/processing/src/test/java/org/apache/druid/java/util/metrics/ProcFsReaderTest.java
@@ -21,26 +21,26 @@ package org.apache.druid.java.util.metrics;
 
 import org.apache.druid.java.util.common.FileUtils;
 import org.apache.druid.java.util.metrics.cgroups.TestUtils;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.File;
 import java.io.IOException;
-import java.nio.file.Path;
 import java.nio.file.Paths;
 
 public class ProcFsReaderTest
 {
-  @TempDir
-  Path tempDir;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
   private File procDir;
 
   @BeforeEach
   public void setUp() throws IOException
   {
-    procDir = FileUtils.createTempDirInLocation(tempDir, "procDir");
+    procDir = temporaryFolder.newFolder("procDir");
     File kernelDir = new File(
         procDir,
         "sys/kernel/random"
diff --git a/processing/src/test/java/org/apache/druid/java/util/metrics/cgroups/CpuAcctTest.java b/processing/src/test/java/org/apache/druid/java/util/metrics/cgroups/CpuAcctTest.java
index 2de35f4cc5b..0eaf52959da 100644
--- a/processing/src/test/java/org/apache/druid/java/util/metrics/cgroups/CpuAcctTest.java
+++ b/processing/src/test/java/org/apache/druid/java/util/metrics/cgroups/CpuAcctTest.java
@@ -36,7 +36,7 @@ import java.util.stream.LongStream;
 public class CpuAcctTest
 {
   @RegisterExtension
-  public TemporaryFolderExtension temporaryFolder = new TemporaryFolderExtension();
+  public TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
   private File procDir;
   private File cgroupDir;
   private CgroupDiscoverer discoverer;
diff --git a/processing/src/test/java/org/apache/druid/java/util/metrics/cgroups/CpuSetTest.java b/processing/src/test/java/org/apache/druid/java/util/metrics/cgroups/CpuSetTest.java
index db71c9290f2..b4da2a3f19d 100644
--- a/processing/src/test/java/org/apache/druid/java/util/metrics/cgroups/CpuSetTest.java
+++ b/processing/src/test/java/org/apache/druid/java/util/metrics/cgroups/CpuSetTest.java
@@ -20,28 +20,28 @@
 package org.apache.druid.java.util.metrics.cgroups;
 
 import org.apache.druid.java.util.common.FileUtils;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.File;
 import java.io.IOException;
-import java.nio.file.Path;
 
 
 public class CpuSetTest
 {
-  @TempDir
-  Path tempDir;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
   private CgroupDiscoverer discoverer;
   private File cpusetDir;
 
   @BeforeEach
   public void setUp() throws IOException
   {
-    File cgroupDir = FileUtils.createTempDirInLocation(tempDir, "cgroupDir");
-    File procDir = FileUtils.createTempDirInLocation(tempDir, "procDir");
+    File cgroupDir = temporaryFolder.newFolder("cgroupDir");
+    File procDir = temporaryFolder.newFolder("procDir");
     discoverer = new ProcCgroupDiscoverer(procDir.toPath());
     TestUtils.setUpCgroups(procDir, cgroupDir);
     cpusetDir = new File(
diff --git a/processing/src/test/java/org/apache/druid/java/util/metrics/cgroups/CpuSetV2Test.java b/processing/src/test/java/org/apache/druid/java/util/metrics/cgroups/CpuSetV2Test.java
index 129c5e53af7..03007f6ef1c 100644
--- a/processing/src/test/java/org/apache/druid/java/util/metrics/cgroups/CpuSetV2Test.java
+++ b/processing/src/test/java/org/apache/druid/java/util/metrics/cgroups/CpuSetV2Test.java
@@ -19,10 +19,11 @@
 
 package org.apache.druid.java.util.metrics.cgroups;
 
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.File;
 import java.io.IOException;
@@ -32,8 +33,8 @@ import java.nio.file.Paths;
 
 public class CpuSetV2Test
 {
-  @TempDir
-  public File temporaryFolder;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   private File cgroupDir;
   private File procDir;
@@ -42,10 +43,8 @@ public class CpuSetV2Test
   @BeforeEach
   public void setUp() throws IOException
   {
-    cgroupDir = new File(temporaryFolder, "cgroup");
-    cgroupDir.mkdir();
-    procDir = new File(temporaryFolder, "proc");
-    procDir.mkdir();
+    cgroupDir = temporaryFolder.newFolder("cgroup");
+    procDir = temporaryFolder.newFolder("proc");
     TestUtils.setUpCgroupsV2(procDir, cgroupDir);
     discoverer = new ProcCgroupV2Discoverer(procDir.toPath());
   }
diff --git a/processing/src/test/java/org/apache/druid/java/util/metrics/cgroups/CpuTest.java b/processing/src/test/java/org/apache/druid/java/util/metrics/cgroups/CpuTest.java
index 1068156f3d1..005eeafdf66 100644
--- a/processing/src/test/java/org/apache/druid/java/util/metrics/cgroups/CpuTest.java
+++ b/processing/src/test/java/org/apache/druid/java/util/metrics/cgroups/CpuTest.java
@@ -20,27 +20,27 @@
 package org.apache.druid.java.util.metrics.cgroups;
 
 import org.apache.druid.java.util.common.FileUtils;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.File;
 import java.io.IOException;
-import java.nio.file.Path;
 
 
 public class CpuTest
 {
-  @TempDir
-  Path tempDir;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
   private CgroupDiscoverer discoverer;
 
   @BeforeEach
   public void setUp() throws IOException
   {
-    File cgroupDir = FileUtils.createTempDirInLocation(tempDir, "cgroupDir");
-    File procDir = FileUtils.createTempDirInLocation(tempDir, "procDir");
+    File cgroupDir = temporaryFolder.newFolder("cgroupDir");
+    File procDir = temporaryFolder.newFolder("procDir");
     discoverer = new ProcCgroupDiscoverer(procDir.toPath());
     TestUtils.setUpCgroups(procDir, cgroupDir);
     final File cpuDir = new File(
diff --git a/processing/src/test/java/org/apache/druid/java/util/metrics/cgroups/CpuV2Test.java b/processing/src/test/java/org/apache/druid/java/util/metrics/cgroups/CpuV2Test.java
index 7f171418fb7..206899aab9b 100644
--- a/processing/src/test/java/org/apache/druid/java/util/metrics/cgroups/CpuV2Test.java
+++ b/processing/src/test/java/org/apache/druid/java/util/metrics/cgroups/CpuV2Test.java
@@ -34,7 +34,7 @@ import java.nio.file.Paths;
 public class CpuV2Test
 {
   @RegisterExtension
-  public TemporaryFolderExtension temporaryFolder = new TemporaryFolderExtension();
+  public TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   private File cgroupDir;
   private File procDir;
diff --git a/processing/src/test/java/org/apache/druid/java/util/metrics/cgroups/DiskTest.java b/processing/src/test/java/org/apache/druid/java/util/metrics/cgroups/DiskTest.java
index 88f54425b1d..eb7f8b58e1f 100644
--- a/processing/src/test/java/org/apache/druid/java/util/metrics/cgroups/DiskTest.java
+++ b/processing/src/test/java/org/apache/druid/java/util/metrics/cgroups/DiskTest.java
@@ -22,19 +22,19 @@ package org.apache.druid.java.util.metrics.cgroups;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
 import org.apache.druid.java.util.common.FileUtils;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.File;
-import java.nio.file.Path;
 import java.util.Map;
 
 public class DiskTest
 {
-  @TempDir
-  Path tempDir;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
   private File procDir;
   private File cgroupDir;
   private CgroupDiscoverer discoverer;
@@ -42,8 +42,8 @@ public class DiskTest
   @BeforeEach
   public void setUp() throws Exception
   {
-    cgroupDir = FileUtils.createTempDirInLocation(tempDir, "cgroupDir");
-    procDir = FileUtils.createTempDirInLocation(tempDir, "procDir");
+    cgroupDir = temporaryFolder.newFolder("cgroupDir");
+    procDir = temporaryFolder.newFolder("procDir");
     discoverer = new ProcCgroupDiscoverer(procDir.toPath());
     TestUtils.setUpCgroups(procDir, cgroupDir);
     final File blkioDir = new File(
diff --git a/processing/src/test/java/org/apache/druid/java/util/metrics/cgroups/MemoryTest.java b/processing/src/test/java/org/apache/druid/java/util/metrics/cgroups/MemoryTest.java
index 1bbda52e580..1d03c399697 100644
--- a/processing/src/test/java/org/apache/druid/java/util/metrics/cgroups/MemoryTest.java
+++ b/processing/src/test/java/org/apache/druid/java/util/metrics/cgroups/MemoryTest.java
@@ -21,20 +21,20 @@ package org.apache.druid.java.util.metrics.cgroups;
 
 import com.google.common.collect.ImmutableMap;
 import org.apache.druid.java.util.common.FileUtils;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.File;
-import java.nio.file.Path;
 import java.util.HashMap;
 import java.util.Map;
 
 public class MemoryTest
 {
-  @TempDir
-  private Path tempDir;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
   private File procDir;
   private File cgroupDir;
   private CgroupDiscoverer discoverer;
@@ -42,8 +42,8 @@ public class MemoryTest
   @BeforeEach
   public void setUp() throws Exception
   {
-    cgroupDir = FileUtils.createTempDirInLocation(tempDir, "cgroupDir");
-    procDir = FileUtils.createTempDirInLocation(tempDir, "procDir");
+    cgroupDir = temporaryFolder.newFolder("cgroupDir");
+    procDir = temporaryFolder.newFolder("procDir");
     discoverer = new ProcCgroupDiscoverer(procDir.toPath());
     TestUtils.setUpCgroups(procDir, cgroupDir);
     final File memoryDir = new File(
diff --git a/processing/src/test/java/org/apache/druid/java/util/metrics/cgroups/ProcCgroupDiscovererTest.java b/processing/src/test/java/org/apache/druid/java/util/metrics/cgroups/ProcCgroupDiscovererTest.java
index a4ec7ea7b34..6199264f5dc 100644
--- a/processing/src/test/java/org/apache/druid/java/util/metrics/cgroups/ProcCgroupDiscovererTest.java
+++ b/processing/src/test/java/org/apache/druid/java/util/metrics/cgroups/ProcCgroupDiscovererTest.java
@@ -21,19 +21,19 @@ package org.apache.druid.java.util.metrics.cgroups;
 
 import com.google.common.collect.ImmutableSet;
 import org.apache.druid.java.util.common.FileUtils;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.File;
-import java.nio.file.Path;
 import java.nio.file.Paths;
 
 public class ProcCgroupDiscovererTest
 {
-  @TempDir
-  private Path tempDir;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
   private File procDir;
   private File cgroupDir;
   private CgroupDiscoverer discoverer;
@@ -41,8 +41,8 @@ public class ProcCgroupDiscovererTest
   @BeforeEach
   public void setUp() throws Exception
   {
-    cgroupDir = FileUtils.createTempDirInLocation(tempDir, "cgroup");
-    procDir = FileUtils.createTempDirInLocation(tempDir, "proc");
+    cgroupDir = temporaryFolder.newFolder("cgroup");
+    procDir = temporaryFolder.newFolder("proc");
     discoverer = new ProcCgroupDiscoverer(procDir.toPath());
     TestUtils.setUpCgroups(procDir, cgroupDir);
   }
@@ -89,8 +89,8 @@ public class ProcCgroupDiscovererTest
   @Test
   public void testFallBack() throws Exception
   {
-    File cgroupDir = FileUtils.createTempDirInLocation(tempDir, "fallbackCgroup");
-    File procDir = FileUtils.createTempDirInLocation(tempDir, "fallbackProc");
+    File cgroupDir = temporaryFolder.newFolder("fallbackCgroup");
+    File procDir = temporaryFolder.newFolder("fallbackProc");
     TestUtils.setUpCgroups(procDir, cgroupDir);
 
     // Swap out the cgroup path with a default path
diff --git a/processing/src/test/java/org/apache/druid/query/CursorGranularizerTest.java b/processing/src/test/java/org/apache/druid/query/CursorGranularizerTest.java
index 0d8fa42647f..5d3540a71e3 100644
--- a/processing/src/test/java/org/apache/druid/query/CursorGranularizerTest.java
+++ b/processing/src/test/java/org/apache/druid/query/CursorGranularizerTest.java
@@ -44,21 +44,21 @@ import org.apache.druid.segment.column.ColumnType;
 import org.apache.druid.segment.column.RowSignature;
 import org.apache.druid.segment.incremental.IncrementalIndexSchema;
 import org.apache.druid.testing.InitializedNullHandlingTest;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.joda.time.Interval;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
-import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
 public class CursorGranularizerTest extends InitializedNullHandlingTest
 {
-  @TempDir
-  public File temporaryFolder;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   private CursorFactory cursorFactory;
   private TimeBoundaryInspector timeBoundaryInspector;
@@ -156,7 +156,7 @@ public class CursorGranularizerTest extends InitializedNullHandlingTest
                             )
                         )
                     )
-                    .tmpDir(temporaryFolder);
+                    .tmpDir(temporaryFolder.getRoot());
 
     final QueryableIndex index = bob.buildMMappedIndex(Intervals.of("2024-01-01T00:00Z/2024-01-02T00:00Z"));
     interval = index.getDataInterval();
diff --git a/processing/src/test/java/org/apache/druid/query/MultiValuedDimensionTest.java b/processing/src/test/java/org/apache/druid/query/MultiValuedDimensionTest.java
index 8a9402312a5..4293fe9553d 100644
--- a/processing/src/test/java/org/apache/druid/query/MultiValuedDimensionTest.java
+++ b/processing/src/test/java/org/apache/druid/query/MultiValuedDimensionTest.java
@@ -72,6 +72,7 @@ import org.apache.druid.segment.writeout.OffHeapMemorySegmentWriteOutMediumFacto
 import org.apache.druid.segment.writeout.SegmentWriteOutMediumFactory;
 import org.apache.druid.segment.writeout.TmpFileSegmentWriteOutMediumFactory;
 import org.apache.druid.testing.InitializedNullHandlingTest;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.apache.druid.timeline.SegmentId;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.Assertions;
@@ -125,10 +126,10 @@ public class MultiValuedDimensionTest extends InitializedNullHandlingTest
 
   public MultiValuedDimensionTest(final GroupByQueryConfig config, SegmentWriteOutMediumFactory segmentWriteOutMediumFactory, boolean forceHashAggregation)
   {
-    helper = AggregationTestHelper.createGroupByQueryAggregationTestHelperWithTemporaryFolderExtension(
+    helper = AggregationTestHelper.createGroupByQueryAggregationTestHelper(
         ImmutableList.of(),
         config,
-        null
+        (TemporaryFolderExtension) null
     );
     this.config = config;
     this.segmentWriteOutMediumFactory = segmentWriteOutMediumFactory;
diff --git a/processing/src/test/java/org/apache/druid/query/NestedDataTestUtils.java b/processing/src/test/java/org/apache/druid/query/NestedDataTestUtils.java
index 38a7ebe0f28..e05e8c86bd0 100644
--- a/processing/src/test/java/org/apache/druid/query/NestedDataTestUtils.java
+++ b/processing/src/test/java/org/apache/druid/query/NestedDataTestUtils.java
@@ -52,7 +52,6 @@ import org.apache.druid.segment.transform.ExpressionTransform;
 import org.apache.druid.segment.transform.TransformSpec;
 import org.apache.druid.testing.TemporaryFolderExtension;
 import org.apache.druid.timeline.SegmentId;
-import org.junit.rules.TemporaryFolder;
 
 import java.io.ByteArrayInputStream;
 import java.io.File;
@@ -144,104 +143,6 @@ public class NestedDataTestUtils
     JSON_MAPPER.registerModules(BuiltInTypesModule.getJacksonModulesList());
   }
 
-  /**
-   * Temporary compatibility bridge for the JUnit 4 {@link TemporaryFolder} and JUnit 5
-   * {@link TemporaryFolderExtension} APIs. The segment builders use this common surface while
-   * both test styles remain in use; remove it with the {@code TemporaryFolder} overloads once
-   * all callers have migrated to {@link TemporaryFolderExtension}.
-   */
-  private interface TempFolderOperations
-  {
-    File newFolder() throws IOException;
-
-    File newFolder(String... folderNames) throws IOException;
-
-    File newFile() throws IOException;
-
-    File newFile(String fileName) throws IOException;
-  }
-
-  private static TempFolderOperations tempFolderOperations(final TemporaryFolder tempFolder)
-  {
-    return new TempFolderOperations()
-    {
-      @Override
-      public File newFolder() throws IOException
-      {
-        return tempFolder.newFolder();
-      }
-
-      @Override
-      public File newFolder(final String... folderNames) throws IOException
-      {
-        return tempFolder.newFolder(folderNames);
-      }
-
-      @Override
-      public File newFile() throws IOException
-      {
-        return tempFolder.newFile();
-      }
-
-      @Override
-      public File newFile(final String fileName) throws IOException
-      {
-        return tempFolder.newFile(fileName);
-      }
-    };
-  }
-
-  private static TempFolderOperations tempFolderOperations(final TemporaryFolderExtension tempFolder)
-  {
-    return new TempFolderOperations()
-    {
-      @Override
-      public File newFolder() throws IOException
-      {
-        return tempFolder.newFolder();
-      }
-
-      @Override
-      public File newFolder(final String... folderNames) throws IOException
-      {
-        return tempFolder.newFolder(folderNames);
-      }
-
-      @Override
-      public File newFile() throws IOException
-      {
-        return tempFolder.newFile();
-      }
-
-      @Override
-      public File newFile(final String fileName) throws IOException
-      {
-        return tempFolder.newFile(fileName);
-      }
-    };
-  }
-
-  public static List<Segment> createSegmentsWithConcatenatedJsonInput(
-      TemporaryFolder tempFolder,
-      Closer closer,
-      String inputFile,
-      Granularity granularity,
-      boolean rollup,
-      int numCopies,
-      int numSegments
-  ) throws Exception
-  {
-    return createSegmentsWithConcatenatedJsonInput(
-        tempFolderOperations(tempFolder),
-        closer,
-        inputFile,
-        granularity,
-        rollup,
-        numCopies,
-        numSegments
-    );
-  }
-
   public static List<Segment> createSegmentsWithConcatenatedJsonInput(
       TemporaryFolderExtension tempFolder,
       Closer closer,
@@ -252,41 +153,20 @@ public class NestedDataTestUtils
       int numSegments
   ) throws Exception
   {
-    return createSegmentsWithConcatenatedJsonInput(
-        tempFolderOperations(tempFolder),
-        closer,
-        inputFile,
-        granularity,
-        rollup,
-        numCopies,
-        numSegments
-    );
-  }
-
-  private static List<Segment> createSegmentsWithConcatenatedJsonInput(
-      final TempFolderOperations tempFolder,
-      final Closer closer,
-      final String inputFile,
-      final Granularity granularity,
-      final boolean rollup,
-      final int numCopies,
-      final int numSegments
-  ) throws Exception
-  {
-    List<InputSource> inputFiles = Lists.newArrayListWithCapacity(numSegments);
+    final List<InputSource> inputFiles = Lists.newArrayListWithCapacity(numSegments);
     for (int i = 0; i < numSegments; i++) {
-      File file = selfConcatenateResourceFile(tempFolder, inputFile, numCopies);
+      final File file = selfConcatenateResourceFile(tempFolder, inputFile, numCopies);
       inputFiles.add(new LocalInputSource(file.getParentFile(), file.getName()));
     }
     return new ResourceFileSegmentBuilder(tempFolder, closer).inputSources(inputFiles)
-                                                 .granularity(granularity)
-                                                 .rollup(rollup)
-                                                 .build();
+                                                             .granularity(granularity)
+                                                             .rollup(rollup)
+                                                             .build();
   }
 
   public static class ResourceFileSegmentBuilder
   {
-    private final TempFolderOperations tempFolder;
+    private final TemporaryFolderExtension tempFolder;
     private final Closer closer;
 
     private List<InputSource> inputSources =
@@ -310,17 +190,7 @@ public class NestedDataTestUtils
      * <li>rollup is on by default</li>
      * <li>use the default index spec</li>
      */
-    public ResourceFileSegmentBuilder(TemporaryFolder tempFolder, Closer closer)
-    {
-      this(tempFolderOperations(tempFolder), closer);
-    }
-
     public ResourceFileSegmentBuilder(TemporaryFolderExtension tempFolder, Closer closer)
-    {
-      this(tempFolderOperations(tempFolder), closer);
-    }
-
-    private ResourceFileSegmentBuilder(TempFolderOperations tempFolder, Closer closer)
     {
       this.tempFolder = tempFolder;
       this.closer = closer;
@@ -422,39 +292,6 @@ public class NestedDataTestUtils
     }
   }
 
-  /**
-   * @deprecated Use {@link ResourceFileSegmentBuilder} instead.
-   */
-  @Deprecated
-  public static List<Segment> createSegments(
-      TemporaryFolder tempFolder,
-      Closer closer,
-      String input,
-      InputFormat inputFormat,
-      TimestampSpec timestampSpec,
-      DimensionsSpec dimensionsSpec,
-      TransformSpec transformSpec,
-      AggregatorFactory[] aggregators,
-      Granularity queryGranularity,
-      boolean rollup,
-      IndexSpec indexSpec
-  ) throws Exception
-  {
-    return createSegments(
-        tempFolderOperations(tempFolder),
-        closer,
-        Collections.singletonList(ResourceInputSource.of(NestedDataTestUtils.class.getClassLoader(), input)),
-        inputFormat,
-        timestampSpec,
-        dimensionsSpec,
-        transformSpec,
-        aggregators,
-        queryGranularity,
-        rollup,
-        indexSpec
-    );
-  }
-
   /**
    * @deprecated Use {@link ResourceFileSegmentBuilder} instead.
    */
@@ -474,7 +311,7 @@ public class NestedDataTestUtils
   ) throws Exception
   {
     return createSegments(
-        tempFolderOperations(tempFolder),
+        tempFolder,
         closer,
         Collections.singletonList(ResourceInputSource.of(NestedDataTestUtils.class.getClassLoader(), input)),
         inputFormat,
@@ -488,35 +325,6 @@ public class NestedDataTestUtils
     );
   }
 
-  public static List<Segment> createSegments(
-      TemporaryFolder tempFolder,
-      Closer closer,
-      List<InputSource> inputs,
-      InputFormat inputFormat,
-      TimestampSpec timestampSpec,
-      DimensionsSpec dimensionsSpec,
-      TransformSpec transformSpec,
-      AggregatorFactory[] aggregators,
-      Granularity queryGranularity,
-      boolean rollup,
-      IndexSpec indexSpec
-  ) throws Exception
-  {
-    return createSegments(
-        tempFolderOperations(tempFolder),
-        closer,
-        inputs,
-        inputFormat,
-        timestampSpec,
-        dimensionsSpec,
-        transformSpec,
-        aggregators,
-        queryGranularity,
-        rollup,
-        indexSpec
-    );
-  }
-
   public static List<Segment> createSegments(
       TemporaryFolderExtension tempFolder,
       Closer closer,
@@ -530,56 +338,27 @@ public class NestedDataTestUtils
       boolean rollup,
       IndexSpec indexSpec
   ) throws Exception
-  {
-    return createSegments(
-        tempFolderOperations(tempFolder),
-        closer,
-        inputs,
-        inputFormat,
-        timestampSpec,
-        dimensionsSpec,
-        transformSpec,
-        aggregators,
-        queryGranularity,
-        rollup,
-        indexSpec
-    );
-  }
-
-  private static List<Segment> createSegments(
-      final TempFolderOperations tempFolder,
-      final Closer closer,
-      final List<InputSource> inputs,
-      final InputFormat inputFormat,
-      final TimestampSpec timestampSpec,
-      final DimensionsSpec dimensionsSpec,
-      final TransformSpec transformSpec,
-      final AggregatorFactory[] aggregators,
-      final Granularity queryGranularity,
-      final boolean rollup,
-      final IndexSpec indexSpec
-  ) throws Exception
   {
     final List<Segment> segments = Lists.newArrayListWithCapacity(inputs.size());
     for (InputSource inputSource : inputs) {
       final File segmentDir = tempFolder.newFolder();
-      IndexBuilder bob = IndexBuilder.create()
-                                     .tmpDir(segmentDir)
-                                     .schema(
-                                         IncrementalIndexSchema.builder()
-                                                               .withTimestampSpec(timestampSpec)
-                                                               .withDimensionsSpec(dimensionsSpec)
-                                                               .withMetrics(aggregators)
-                                                               .withQueryGranularity(queryGranularity)
-                                                               .withRollup(rollup)
-                                                               .withMinTimestamp(0)
-                                                               .build()
-                                     )
-                                     .indexSpec(indexSpec)
-                                     .inputSource(inputSource)
-                                     .inputFormat(inputFormat)
-                                     .transform(transformSpec)
-                                     .inputTmpDir(tempFolder.newFolder());
+      final IndexBuilder bob = IndexBuilder.create()
+                                            .tmpDir(segmentDir)
+                                            .schema(
+                                                IncrementalIndexSchema.builder()
+                                                                      .withTimestampSpec(timestampSpec)
+                                                                      .withDimensionsSpec(dimensionsSpec)
+                                                                      .withMetrics(aggregators)
+                                                                      .withQueryGranularity(queryGranularity)
+                                                                      .withRollup(rollup)
+                                                                      .withMinTimestamp(0)
+                                                                      .build()
+                                            )
+                                            .indexSpec(indexSpec)
+                                            .inputSource(inputSource)
+                                            .inputFormat(inputFormat)
+                                            .transform(transformSpec)
+                                            .inputTmpDir(tempFolder.newFolder());
       segments.add(
           new QueryableIndexSegment(
               closer.register(bob.buildMMappedIndex()),
@@ -594,39 +373,21 @@ public class NestedDataTestUtils
   /**
    * turn a small file into bigger file with a bunch of copies of itself
    */
-  public static File selfConcatenateResourceFile(
-      TemporaryFolder tempFolder,
-      String inputFileName,
-      int numCopies
-  ) throws IOException
-  {
-    return selfConcatenateResourceFile(tempFolderOperations(tempFolder), inputFileName, numCopies);
-  }
-
   public static File selfConcatenateResourceFile(
       TemporaryFolderExtension tempFolder,
       String inputFileName,
       int numCopies
   ) throws IOException
   {
-    return selfConcatenateResourceFile(tempFolderOperations(tempFolder), inputFileName, numCopies);
-  }
-
-  private static File selfConcatenateResourceFile(
-      final TempFolderOperations tempFolder,
-      final String inputFileName,
-      final int numCopies
-  ) throws IOException
-  {
-    List<InputStream> inputStreams = Lists.newArrayListWithCapacity(numCopies);
+    final List<InputStream> inputStreams = Lists.newArrayListWithCapacity(numCopies);
     for (int i = 0; i < numCopies; i++) {
-      InputStream stream = NestedDataTestUtils.class.getClassLoader().getResourceAsStream(inputFileName);
+      final InputStream stream = NestedDataTestUtils.class.getClassLoader().getResourceAsStream(inputFileName);
       inputStreams.add(stream);
       if (i + 1 < numCopies) {
         inputStreams.add(new ByteArrayInputStream(StringUtils.toUtf8("\n")));
       }
     }
-    File tmpFile = tempFolder.newFile();
+    final File tmpFile = tempFolder.newFile();
     try (
         SequenceInputStream inputDataStream = new SequenceInputStream(Collections.enumeration(inputStreams));
         OutputStream outStream = Files.newOutputStream(tmpFile.toPath())
@@ -641,16 +402,16 @@ public class NestedDataTestUtils
     return tmpFile;
   }
 
-  public static List<BiFunction<TemporaryFolder, Closer, List<Segment>>> getSegmentGenerators(
+  public static List<BiFunction<TemporaryFolderExtension, Closer, List<Segment>>> getSegmentGenerators(
       String jsonInputFile
   )
   {
-    final List<BiFunction<TemporaryFolder, Closer, List<Segment>>> segmentsGenerators =
+    final List<BiFunction<TemporaryFolderExtension, Closer, List<Segment>>> segmentsGenerators =
         new ArrayList<>();
     segmentsGenerators.add(new BiFunction<>()
     {
       @Override
-      public List<Segment> apply(TemporaryFolder tempFolder, Closer closer)
+      public List<Segment> apply(TemporaryFolderExtension tempFolder, Closer closer)
       {
         try {
           return ImmutableList.<Segment>builder()
@@ -672,7 +433,7 @@ public class NestedDataTestUtils
     segmentsGenerators.add(new BiFunction<>()
     {
       @Override
-      public List<Segment> apply(TemporaryFolder tempFolder, Closer closer)
+      public List<Segment> apply(TemporaryFolderExtension tempFolder, Closer closer)
       {
         try {
           return ImmutableList.of(
@@ -694,7 +455,7 @@ public class NestedDataTestUtils
     segmentsGenerators.add(new BiFunction<>()
     {
       @Override
-      public List<Segment> apply(TemporaryFolder tempFolder, Closer closer)
+      public List<Segment> apply(TemporaryFolderExtension tempFolder, Closer closer)
       {
         try {
           return ImmutableList.<Segment>builder()
@@ -716,7 +477,7 @@ public class NestedDataTestUtils
     segmentsGenerators.add(new BiFunction<>()
     {
       @Override
-      public List<Segment> apply(TemporaryFolder tempFolder, Closer closer)
+      public List<Segment> apply(TemporaryFolderExtension tempFolder, Closer closer)
       {
         try {
           return Stream.of(
diff --git a/processing/src/test/java/org/apache/druid/query/SchemaEvolutionTest.java b/processing/src/test/java/org/apache/druid/query/SchemaEvolutionTest.java
index bfb1731f7c9..3d8babb3443 100644
--- a/processing/src/test/java/org/apache/druid/query/SchemaEvolutionTest.java
+++ b/processing/src/test/java/org/apache/druid/query/SchemaEvolutionTest.java
@@ -125,7 +125,7 @@ public class SchemaEvolutionTest
   }
 
   @RegisterExtension
-  public final TemporaryFolderExtension temporaryFolder = new TemporaryFolderExtension();
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   // Index1: c1 is a string, c2 nonexistent, "uniques" nonexistent
   private QueryableIndex index1 = null;
diff --git a/processing/src/test/java/org/apache/druid/query/aggregation/AggregationTestHelper.java b/processing/src/test/java/org/apache/druid/query/aggregation/AggregationTestHelper.java
index 2612727ad33..4eaeae31a6c 100644
--- a/processing/src/test/java/org/apache/druid/query/aggregation/AggregationTestHelper.java
+++ b/processing/src/test/java/org/apache/druid/query/aggregation/AggregationTestHelper.java
@@ -86,7 +86,6 @@ import org.apache.druid.segment.writeout.OffHeapMemorySegmentWriteOutMediumFacto
 import org.apache.druid.testing.TemporaryFolderExtension;
 import org.apache.druid.timeline.SegmentId;
 import org.apache.druid.utils.CloseableUtils;
-import org.junit.rules.TemporaryFolder;
 
 import javax.annotation.Nullable;
 import java.io.Closeable;
@@ -156,19 +155,6 @@ public class AggregationTestHelper implements Closeable
   }
 
   public static AggregationTestHelper createGroupByQueryAggregationTestHelper(
-      List<? extends Module> jsonModulesToRegister,
-      GroupByQueryConfig config,
-      TemporaryFolder tempFolder
-  )
-  {
-    return createGroupByQueryAggregationTestHelper(
-        jsonModulesToRegister,
-        config,
-        tempFolderProvider(tempFolder)
-    );
-  }
-
-  public static AggregationTestHelper createGroupByQueryAggregationTestHelperWithTemporaryFolderExtension(
       List<? extends Module> jsonModulesToRegister,
       GroupByQueryConfig config,
       TemporaryFolderExtension tempFolder
@@ -181,7 +167,7 @@ public class AggregationTestHelper implements Closeable
     );
   }
 
-  public static AggregationTestHelper createGroupByQueryAggregationTestHelperWithTempDir(
+  public static AggregationTestHelper createGroupByQueryAggregationTestHelper(
       List<? extends Module> jsonModulesToRegister,
       GroupByQueryConfig config,
       File tempFolder
@@ -233,17 +219,6 @@ public class AggregationTestHelper implements Closeable
   }
 
   public static AggregationTestHelper createTimeseriesQueryAggregationTestHelper(
-      List<? extends Module> jsonModulesToRegister,
-      TemporaryFolder tempFolder
-  )
-  {
-    return createTimeseriesQueryAggregationTestHelper(
-        jsonModulesToRegister,
-        tempFolderProvider(tempFolder)
-    );
-  }
-
-  public static AggregationTestHelper createTimeseriesQueryAggregationTestHelperWithTemporaryFolderExtension(
       List<? extends Module> jsonModulesToRegister,
       TemporaryFolderExtension tempFolder
   )
@@ -301,17 +276,6 @@ public class AggregationTestHelper implements Closeable
   }
 
   public static AggregationTestHelper createTopNQueryAggregationTestHelper(
-      List<? extends Module> jsonModulesToRegister,
-      TemporaryFolder tempFolder
-  )
-  {
-    return createTopNQueryAggregationTestHelper(
-        jsonModulesToRegister,
-        tempFolderProvider(tempFolder)
-    );
-  }
-
-  public static AggregationTestHelper createTopNQueryAggregationTestHelperWithTemporaryFolderExtension(
       List<? extends Module> jsonModulesToRegister,
       TemporaryFolderExtension tempFolder
   )
@@ -381,17 +345,6 @@ public class AggregationTestHelper implements Closeable
   }
 
   public static AggregationTestHelper createScanQueryAggregationTestHelper(
-      List<? extends Module> jsonModulesToRegister,
-      TemporaryFolder tempFolder
-  )
-  {
-    return createScanQueryAggregationTestHelper(
-        jsonModulesToRegister,
-        tempFolderProvider(tempFolder)
-    );
-  }
-
-  public static AggregationTestHelper createScanQueryAggregationTestHelperWithTemporaryFolderExtension(
       List<? extends Module> jsonModulesToRegister,
       TemporaryFolderExtension tempFolder
   )
@@ -456,11 +409,6 @@ public class AggregationTestHelper implements Closeable
     return () -> tempFolder.newFolder();
   }
 
-  private static TempFolderProvider tempFolderProvider(final TemporaryFolder tempFolder)
-  {
-    return () -> tempFolder.newFolder();
-  }
-
   private static TempFolderProvider tempFolderProvider(final File tempFolder)
   {
     return () -> FileUtils.createTempDirInLocation(tempFolder.toPath(), "druid-");
diff --git a/processing/src/test/java/org/apache/druid/query/aggregation/ExpressionLambdaAggregationTest.java b/processing/src/test/java/org/apache/druid/query/aggregation/ExpressionLambdaAggregationTest.java
index be7831234ac..0de24279b1e 100644
--- a/processing/src/test/java/org/apache/druid/query/aggregation/ExpressionLambdaAggregationTest.java
+++ b/processing/src/test/java/org/apache/druid/query/aggregation/ExpressionLambdaAggregationTest.java
@@ -66,7 +66,7 @@ public class ExpressionLambdaAggregationTest extends InitializedNullHandlingTest
   private static final DateTime TIMESTAMP = DateTimes.of("2020-01-01");
 
   @RegisterExtension
-  public final TemporaryFolderExtension tempFolder = new TemporaryFolderExtension();
+  public final TemporaryFolderExtension tempFolder = TemporaryFolderExtension.testCaseScoped();
 
   private QueryableIndex mergedIndex;
   private Segment segment;
@@ -184,7 +184,7 @@ public class ExpressionLambdaAggregationTest extends InitializedNullHandlingTest
                                         .build();
 
     try (final AggregationTestHelper helper =
-             AggregationTestHelper.createTimeseriesQueryAggregationTestHelperWithTemporaryFolderExtension(
+             AggregationTestHelper.createTimeseriesQueryAggregationTestHelper(
                  Collections.emptyList(),
                  tempFolder
              )) {
diff --git a/processing/src/test/java/org/apache/druid/query/aggregation/StringColumnAggregationTest.java b/processing/src/test/java/org/apache/druid/query/aggregation/StringColumnAggregationTest.java
index b4fc1c6e943..4870804d2ca 100644
--- a/processing/src/test/java/org/apache/druid/query/aggregation/StringColumnAggregationTest.java
+++ b/processing/src/test/java/org/apache/druid/query/aggregation/StringColumnAggregationTest.java
@@ -59,7 +59,7 @@ import java.util.List;
 public class StringColumnAggregationTest
 {
   @RegisterExtension
-  public final TemporaryFolderExtension tempFolder = new TemporaryFolderExtension();
+  public final TemporaryFolderExtension tempFolder = TemporaryFolderExtension.testCaseScoped();
 
   private final String singleValue = "singleValue";
   private final String multiValue = "multiValue";
@@ -97,7 +97,7 @@ public class StringColumnAggregationTest
       ));
     }
 
-    aggregationTestHelper = AggregationTestHelper.createGroupByQueryAggregationTestHelperWithTemporaryFolderExtension(
+    aggregationTestHelper = AggregationTestHelper.createGroupByQueryAggregationTestHelper(
         Collections.emptyList(),
         new GroupByQueryConfig(),
         tempFolder
@@ -239,7 +239,7 @@ public class StringColumnAggregationTest
                                   )
                                   .build();
 
-    Sequence seq = AggregationTestHelper.createTimeseriesQueryAggregationTestHelperWithTemporaryFolderExtension(
+    Sequence seq = AggregationTestHelper.createTimeseriesQueryAggregationTestHelper(
         Collections.emptyList(),
         tempFolder
     )
diff --git a/processing/src/test/java/org/apache/druid/query/aggregation/hyperloglog/HyperUniquesAggregationTest.java b/processing/src/test/java/org/apache/druid/query/aggregation/hyperloglog/HyperUniquesAggregationTest.java
index 3225df4a9d2..b91b83f51c6 100644
--- a/processing/src/test/java/org/apache/druid/query/aggregation/hyperloglog/HyperUniquesAggregationTest.java
+++ b/processing/src/test/java/org/apache/druid/query/aggregation/hyperloglog/HyperUniquesAggregationTest.java
@@ -52,7 +52,7 @@ import java.util.List;
 public class HyperUniquesAggregationTest
 {
   @RegisterExtension
-  public final TemporaryFolderExtension tempFolder = new TemporaryFolderExtension();
+  public final TemporaryFolderExtension tempFolder = TemporaryFolderExtension.testCaseScoped();
 
   private final GroupByQueryConfig config;
 
@@ -74,7 +74,7 @@ public class HyperUniquesAggregationTest
   public void testIngestAndQuery() throws Exception
   {
     try (
-        final AggregationTestHelper helper = AggregationTestHelper.createGroupByQueryAggregationTestHelperWithTemporaryFolderExtension(
+        final AggregationTestHelper helper = AggregationTestHelper.createGroupByQueryAggregationTestHelper(
             Collections.singletonList(new AggregatorsModule()),
             config,
             tempFolder
@@ -124,7 +124,7 @@ public class HyperUniquesAggregationTest
   public void testIngestAndQueryPrecomputedHll() throws Exception
   {
     try (
-        final AggregationTestHelper helper = AggregationTestHelper.createGroupByQueryAggregationTestHelperWithTemporaryFolderExtension(
+        final AggregationTestHelper helper = AggregationTestHelper.createGroupByQueryAggregationTestHelper(
             Collections.singletonList(new AggregatorsModule()),
             config,
             tempFolder
diff --git a/processing/src/test/java/org/apache/druid/query/aggregation/mean/DoubleMeanAggregationTest.java b/processing/src/test/java/org/apache/druid/query/aggregation/mean/DoubleMeanAggregationTest.java
index 3bf16d9ccf6..7fe39ed1a99 100644
--- a/processing/src/test/java/org/apache/druid/query/aggregation/mean/DoubleMeanAggregationTest.java
+++ b/processing/src/test/java/org/apache/druid/query/aggregation/mean/DoubleMeanAggregationTest.java
@@ -70,7 +70,7 @@ public class DoubleMeanAggregationTest
   }
 
   @RegisterExtension
-  public final TemporaryFolderExtension tempFolder = new TemporaryFolderExtension();
+  public final TemporaryFolderExtension tempFolder = TemporaryFolderExtension.testCaseScoped();
 
   private final AggregationTestHelper groupByQueryTestHelper;
   private final AggregationTestHelper timeseriesQueryTestHelper;
@@ -81,13 +81,13 @@ public class DoubleMeanAggregationTest
   public DoubleMeanAggregationTest()
   {
 
-    groupByQueryTestHelper = AggregationTestHelper.createGroupByQueryAggregationTestHelperWithTemporaryFolderExtension(
+    groupByQueryTestHelper = AggregationTestHelper.createGroupByQueryAggregationTestHelper(
         Collections.emptyList(),
         new GroupByQueryConfig(),
         tempFolder
     );
 
-    timeseriesQueryTestHelper = AggregationTestHelper.createTimeseriesQueryAggregationTestHelperWithTemporaryFolderExtension(
+    timeseriesQueryTestHelper = AggregationTestHelper.createTimeseriesQueryAggregationTestHelper(
         Collections.emptyList(),
         tempFolder
     );
diff --git a/processing/src/test/java/org/apache/druid/query/aggregation/post/FinalizingFieldAccessPostAggregatorTest.java b/processing/src/test/java/org/apache/druid/query/aggregation/post/FinalizingFieldAccessPostAggregatorTest.java
index 8c7b514f5a4..2f4baea31cc 100644
--- a/processing/src/test/java/org/apache/druid/query/aggregation/post/FinalizingFieldAccessPostAggregatorTest.java
+++ b/processing/src/test/java/org/apache/druid/query/aggregation/post/FinalizingFieldAccessPostAggregatorTest.java
@@ -67,7 +67,7 @@ import java.util.Map;
 public class FinalizingFieldAccessPostAggregatorTest extends InitializedNullHandlingTest
 {
   @RegisterExtension
-  public final TemporaryFolderExtension tempFoler = new TemporaryFolderExtension();
+  public final TemporaryFolderExtension tempFoler = TemporaryFolderExtension.testCaseScoped();
 
   @Test
   public void testComputeWithoutFinalizing()
@@ -208,7 +208,7 @@ public class FinalizingFieldAccessPostAggregatorTest extends InitializedNullHand
   public void testIngestAndQueryWithArithmeticPostAggregator() throws Exception
   {
     try (
-        final AggregationTestHelper helper = AggregationTestHelper.createGroupByQueryAggregationTestHelperWithTemporaryFolderExtension(
+        final AggregationTestHelper helper = AggregationTestHelper.createGroupByQueryAggregationTestHelper(
             Collections.singletonList(new AggregatorsModule()),
             GroupByQueryRunnerTest.testConfigs().get(0),
             tempFoler
diff --git a/processing/src/test/java/org/apache/druid/query/groupby/ComplexDimensionGroupByQueryTest.java b/processing/src/test/java/org/apache/druid/query/groupby/ComplexDimensionGroupByQueryTest.java
index 2a31147d9d1..321cd949cce 100644
--- a/processing/src/test/java/org/apache/druid/query/groupby/ComplexDimensionGroupByQueryTest.java
+++ b/processing/src/test/java/org/apache/druid/query/groupby/ComplexDimensionGroupByQueryTest.java
@@ -58,12 +58,12 @@ public class ComplexDimensionGroupByQueryTest
   private final List<Segment> segments;
 
   @RegisterExtension
-  public final TemporaryFolderExtension tempFolder = new TemporaryFolderExtension();
+  public final TemporaryFolderExtension tempFolder = TemporaryFolderExtension.testCaseScoped();
 
   public ComplexDimensionGroupByQueryTest(GroupByQueryConfig config, String vectorize)
   {
     this.vectorize = QueryContexts.Vectorize.fromString(vectorize);
-    this.helper = AggregationTestHelper.createGroupByQueryAggregationTestHelperWithTemporaryFolderExtension(
+    this.helper = AggregationTestHelper.createGroupByQueryAggregationTestHelper(
         Collections.emptyList(),
         config,
         tempFolder
diff --git a/processing/src/test/java/org/apache/druid/query/groupby/NestedDataGroupByQueryTest.java b/processing/src/test/java/org/apache/druid/query/groupby/NestedDataGroupByQueryTest.java
index 6d2dc1a2aa9..a5f14e43194 100644
--- a/processing/src/test/java/org/apache/druid/query/groupby/NestedDataGroupByQueryTest.java
+++ b/processing/src/test/java/org/apache/druid/query/groupby/NestedDataGroupByQueryTest.java
@@ -73,7 +73,7 @@ public class NestedDataGroupByQueryTest extends InitializedNullHandlingTest
   private static final Logger LOG = new Logger(NestedDataGroupByQueryTest.class);
 
   @RegisterExtension
-  public final TemporaryFolderExtension tempFolder = new TemporaryFolderExtension();
+  public final TemporaryFolderExtension tempFolder = TemporaryFolderExtension.testCaseScoped();
 
   private final Closer closer;
   private final QueryContexts.Vectorize vectorize;
@@ -89,7 +89,7 @@ public class NestedDataGroupByQueryTest extends InitializedNullHandlingTest
   {
     BuiltInTypesModule.registerHandlersAndSerde();
     this.vectorize = QueryContexts.Vectorize.fromString(vectorize);
-    this.helper = AggregationTestHelper.createGroupByQueryAggregationTestHelperWithTemporaryFolderExtension(
+    this.helper = AggregationTestHelper.createGroupByQueryAggregationTestHelper(
         BuiltInTypesModule.getJacksonModulesList(),
         config,
         tempFolder
diff --git a/processing/src/test/java/org/apache/druid/query/groupby/NestedGroupByArrayQueryTest.java b/processing/src/test/java/org/apache/druid/query/groupby/NestedGroupByArrayQueryTest.java
index 1b102e3d262..67bb012efe0 100644
--- a/processing/src/test/java/org/apache/druid/query/groupby/NestedGroupByArrayQueryTest.java
+++ b/processing/src/test/java/org/apache/druid/query/groupby/NestedGroupByArrayQueryTest.java
@@ -65,7 +65,7 @@ public class NestedGroupByArrayQueryTest
   private static final Logger LOG = new Logger(NestedDataGroupByQueryTest.class);
 
   @RegisterExtension
-  public final TemporaryFolderExtension tempFolder = new TemporaryFolderExtension();
+  public final TemporaryFolderExtension tempFolder = TemporaryFolderExtension.testCaseScoped();
 
   private final Closer closer;
   private final QueryContexts.Vectorize vectorize;
@@ -80,7 +80,7 @@ public class NestedGroupByArrayQueryTest
   {
     BuiltInTypesModule.registerHandlersAndSerde();
     this.vectorize = QueryContexts.Vectorize.fromString(vectorize);
-    this.helper = AggregationTestHelper.createGroupByQueryAggregationTestHelperWithTemporaryFolderExtension(
+    this.helper = AggregationTestHelper.createGroupByQueryAggregationTestHelper(
         BuiltInTypesModule.getJacksonModulesList(),
         config,
         tempFolder
diff --git a/processing/src/test/java/org/apache/druid/query/groupby/UnnestGroupByQueryRunnerTest.java b/processing/src/test/java/org/apache/druid/query/groupby/UnnestGroupByQueryRunnerTest.java
index 875b60de36e..80df6959b98 100644
--- a/processing/src/test/java/org/apache/druid/query/groupby/UnnestGroupByQueryRunnerTest.java
+++ b/processing/src/test/java/org/apache/druid/query/groupby/UnnestGroupByQueryRunnerTest.java
@@ -90,7 +90,7 @@ public class UnnestGroupByQueryRunnerTest extends InitializedNullHandlingTest
   private final boolean vectorize;
 
   @RegisterExtension
-  public final TemporaryFolderExtension tempFolder = new TemporaryFolderExtension();
+  public final TemporaryFolderExtension tempFolder = TemporaryFolderExtension.testCaseScoped();
 
   public UnnestGroupByQueryRunnerTest(
       GroupByQueryConfig config,
diff --git a/processing/src/test/java/org/apache/druid/query/groupby/epinephelinae/ConcurrentGrouperTest.java b/processing/src/test/java/org/apache/druid/query/groupby/epinephelinae/ConcurrentGrouperTest.java
index e7e8ec08db4..b207a79cffb 100644
--- a/processing/src/test/java/org/apache/druid/query/groupby/epinephelinae/ConcurrentGrouperTest.java
+++ b/processing/src/test/java/org/apache/druid/query/groupby/epinephelinae/ConcurrentGrouperTest.java
@@ -76,7 +76,7 @@ public class ConcurrentGrouperTest extends InitializedNullHandlingTest
   private static final ColumnSelectorFactory NULL_FACTORY = new TestColumnSelectorFactory();
 
   @RegisterExtension
-  public TemporaryFolderExtension temporaryFolder = new TemporaryFolderExtension();
+  public TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   private final Supplier<ByteBuffer> bufferSupplier;
   private final int concurrencyHint;
diff --git a/processing/src/test/java/org/apache/druid/query/groupby/epinephelinae/SpillOutputStreamTest.java b/processing/src/test/java/org/apache/druid/query/groupby/epinephelinae/SpillOutputStreamTest.java
index b463132357a..b56458bfc5d 100644
--- a/processing/src/test/java/org/apache/druid/query/groupby/epinephelinae/SpillOutputStreamTest.java
+++ b/processing/src/test/java/org/apache/druid/query/groupby/epinephelinae/SpillOutputStreamTest.java
@@ -20,19 +20,19 @@
 package org.apache.druid.query.groupby.epinephelinae;
 
 import org.apache.druid.query.groupby.GroupByStatsProvider;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
-import java.io.File;
 import java.io.IOException;
 import java.nio.file.Files;
 import java.util.Arrays;
 
 public class SpillOutputStreamTest
 {
-  @TempDir
-  public File temporaryFolder;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   @Test
   public void testSmallWriteStaysInMemory() throws IOException
@@ -263,7 +263,7 @@ public class SpillOutputStreamTest
   private LimitedTemporaryStorage makeStorage(long maxBytes)
   {
     return new LimitedTemporaryStorage(
-        temporaryFolder,
+        temporaryFolder.getRoot(),
         maxBytes,
         100,
         new GroupByStatsProvider.PerQueryStats()
diff --git a/processing/src/test/java/org/apache/druid/query/groupby/epinephelinae/SpillingGrouperTest.java b/processing/src/test/java/org/apache/druid/query/groupby/epinephelinae/SpillingGrouperTest.java
index c3de0b435e0..1a96081e91c 100644
--- a/processing/src/test/java/org/apache/druid/query/groupby/epinephelinae/SpillingGrouperTest.java
+++ b/processing/src/test/java/org/apache/druid/query/groupby/epinephelinae/SpillingGrouperTest.java
@@ -53,7 +53,7 @@ public class SpillingGrouperTest extends InitializedNullHandlingTest
   private static final int INITIAL_BUCKETS = 4;
 
   @RegisterExtension
-  public TemporaryFolderExtension temporaryFolder = new TemporaryFolderExtension();
+  public TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   @Test
   public void testNoSpilling() throws IOException
diff --git a/processing/src/test/java/org/apache/druid/query/lookup/LookupConfigTest.java b/processing/src/test/java/org/apache/druid/query/lookup/LookupConfigTest.java
index 01e15d653eb..cfa435000e5 100644
--- a/processing/src/test/java/org/apache/druid/query/lookup/LookupConfigTest.java
+++ b/processing/src/test/java/org/apache/druid/query/lookup/LookupConfigTest.java
@@ -21,25 +21,24 @@ package org.apache.druid.query.lookup;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.druid.segment.TestHelper;
+import org.apache.druid.testing.TemporaryFolderExtension;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
 
 public class LookupConfigTest
 {
 
   ObjectMapper mapper = TestHelper.makeJsonMapper();
-  @TempDir
-  Path tempDir;
+  @RegisterExtension
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   @Test
   public void testSerDesr() throws IOException
   {
-    LookupConfig lookupConfig = new LookupConfig(Files.createTempFile(tempDir, "junit", null).toFile().getAbsolutePath());
+    LookupConfig lookupConfig = new LookupConfig(temporaryFolder.newFile().getAbsolutePath());
     Assertions.assertEquals(
         lookupConfig,
         mapper.readerFor(LookupConfig.class).readValue(mapper.writeValueAsString(lookupConfig))
diff --git a/processing/src/test/java/org/apache/druid/query/metadata/SegmentAnalyzerTest.java b/processing/src/test/java/org/apache/druid/query/metadata/SegmentAnalyzerTest.java
index 57d3facf42c..af23a0b6568 100644
--- a/processing/src/test/java/org/apache/druid/query/metadata/SegmentAnalyzerTest.java
+++ b/processing/src/test/java/org/apache/druid/query/metadata/SegmentAnalyzerTest.java
@@ -97,7 +97,7 @@ public class SegmentAnalyzerTest extends InitializedNullHandlingTest
       EnumSet.noneOf(SegmentMetadataQuery.AnalysisType.class);
 
   @RegisterExtension
-  public final TemporaryFolderExtension temporaryFolder = new TemporaryFolderExtension();
+  public final TemporaryFolderExtension temporaryFolder = TemporaryFolderExtension.testCaseScoped();
 
   @Test
   public void testIncrementalWorks()
diff --git a/processing/src/test/java/org/apache/druid/query/scan/NestedDataScanQueryTest.java b/processing/src/test/java/org/apache/druid/query/scan/NestedDataScanQueryTest.java
index 750acc074ad..b956d410bcb 100644
--- a/processing/src/test/java/org/apache/druid/query/scan/NestedDataScanQueryTest.java
+++ b/processing/src/test/java/org/apache/druid/query/scan/NestedDataScanQueryTest.java
@@ -77,7 +77,7 @@ public class NestedDataScanQueryTest extends InitializedNullHandlingTest
   DefaultColumnFormatConfig DEFAULT_FORMAT = new DefaultColumnFormatConfig(null, null, null, null);
 
   @RegisterExtension
-  public final TemporaryFolderExtension tempFolder = new TemporaryFolderExtension();
+  public final TemporaryFolderExtension tempFolder = TemporaryFolderExtension.testCaseScoped();
 
   private final AggregationTestHelper helper;
   private final Closer closer;
@@ -121,7 +121,7 @@ public class NestedDataScanQueryTest extends InitializedNullHandlingTest
   {
     BuiltInTypesModule.registerHandlersAndSerde();
     List<? extends Module> mods = BuiltInTypesModule.getJacksonModulesList();
-    this.helper = AggregationTestHelper.createScanQueryAggregationTestHelperWithTemporaryFolderExtension(mods, tempFolder);
+    this.helper = AggregationTestHelper.createScanQueryAggregationTestHelper(mods, tempFolder);
     this.closer = Closer.create();
   }
 
diff --git a/processing/src/test/java/org/apache/druid/query/timeseries/NestedDataTimeseriesQueryTest.java b/processing/src/test/java/org/apache/druid/query/timeseries/NestedDataTimeseriesQueryTest.java
index 259f3ffa719..c994b44167f 100644
--- a/processing/src/test/java/org/apache/druid/query/timeseries/NestedDataTimeseriesQueryTest.java
+++ b/processing/src/test/java/org/apache/druid/query/timeseries/NestedDataTimeseriesQueryTest.java
@@ -85,7 +85,7 @@ public class NestedDataTimeseriesQueryTest extends InitializedNullHandlingTest
   }
 
   @RegisterExtension
-  public final TemporaryFolderExtension tempFolder = new TemporaryFolderExtension();
+  public final TemporaryFolderExtension tempFolder = TemporaryFolderExtension.testCaseScoped();
 
   private final Closer closer;
   private final AggregationTestHelper helper;
@@ -99,7 +99,7 @@ public class NestedDataTimeseriesQueryTest extends InitializedNullHandlingTest
       String vectorize
   )
   {
-    this.helper = AggregationTestHelper.createTimeseriesQueryAggregationTestHelperWithTemporaryFolderExtension(
+    this.helper = AggregationTestHelper.createTimeseriesQueryAggregationTestHelper(
         BuiltInTypesModule.getJacksonModulesList(),
         tempFolder
     );
diff --git a/processing/src/test/java/org/apache/druid/query/topn/NestedDataTopNQueryTest.java b/processing/src/test/java/org/apache/druid/query/topn/NestedDataTopNQueryTest.java
index 4487610f0da..7efea2cd9da 100644
--- a/processing/src/test/java/org/apache/druid/query/topn/NestedDataTopNQueryTest.java
+++ b/processing/src/test/java/org/apache/druid/query/topn/NestedDataTopNQueryTest.java
@@ -63,7 +63,7 @@ public class NestedDataTopNQueryTest extends InitializedNullHandlingTest
   private static final Logger LOG = new Logger(NestedDataTopNQueryTest.class);
 
   @RegisterExtension
-  public final TemporaryFolderExtension tempFolder = new TemporaryFolderExtension();
+  public final TemporaryFolderExtension tempFolder = TemporaryFolderExtension.testCaseScoped();
 
   private final AggregationTestHelper helper;
   private final BiFunction<TemporaryFolderExtension, Closer, List<Segment>> segmentsGenerator;
@@ -74,7 +74,7 @@ public class NestedDataTopNQueryTest extends InitializedNullHandlingTest
   )
   {
     BuiltInTypesModule.registerHandlersAndSerde();
-    this.helper = AggregationTestHelper.createTopNQueryAggregationTestHelperWithTemporaryFolderExtension(
+    this.helper = AggregationTestHelper.createTopNQueryAggregationTestHelper(
         BuiltInTypesModule.getJacksonModulesList(),
         tempFolder
     );
diff --git a/processing/src/test/java/org/apache/druid/segment/CloserExtension.java b/processing/src/test/java/org/apache/druid/segment/CloserExtension.java
index 0a4874a36d8..92a61a88346 100644
--- a/processing/src/test/java/org/apache/druid/segment/CloserExtension.java
+++ b/processing/src/test/java/org/apache/druid/segment/CloserExtension.java
@@ -30,8 +30,8 @@ import java.io.Closeable;
 import java.io.IOException;
 
 /**
- * JUnit 5 counterpart to {@link CloserRule}. The rule remains available for tests that have not
- * migrated yet.
+ * JUnit 5 extension that closes resources registered with {@link #closeLater(Closeable)} after
+ * each test.
  */
 public class CloserExtension implements BeforeEachCallback, AfterEachCallback, TestExecutionExceptionHandler
 {
diff --git a/processing/src/test/java/org/apache/druid/segment/CloserRule.java b/processing/src/test/java/org/apache/druid/segment/CloserRule.java
deleted file mode 100644
index d60fce5a67b..00000000000
--- a/processing/src/test/java/org/apache/druid/segment/CloserRule.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
... 5437 lines suppressed ...


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org