More @DirtiesContext in tests to mitigate memory

* Some other cleanups and modernizations for affected test class and their configurations
This commit is contained in:
Artem Bilan
2024-08-28 14:25:38 -04:00
parent eb07fda61b
commit 730e49adec
22 changed files with 185 additions and 303 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +22,7 @@ import java.net.HttpURLConnection;
import java.net.URL;
import com.rometools.rome.feed.synd.SyndEntry;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -46,15 +47,24 @@ import static org.mockito.Mockito.mock;
*/
public class FeedEntryMessageSourceTests {
static File metadataStoreFile;
@BeforeEach
public void prepare() {
File metadataStoreFile = new File(System.getProperty("java.io.tmpdir") + "/spring-integration/",
metadataStoreFile = new File(System.getProperty("java.io.tmpdir") + "/spring-integration/",
"metadata-store.properties");
if (metadataStoreFile.exists()) {
metadataStoreFile.delete();
}
}
@AfterAll
static void tearDown() {
if (metadataStoreFile.exists()) {
metadataStoreFile.delete();
}
}
@Test
public void testFailureWhenNotInitialized() throws Exception {
URL url = new ClassPathResource("org/springframework/integration/feed/sample.rss").getURL();