(james-jspf) 05/06: Clear dnsjava cache before each test

[email protected]
Newsgroups gmane.comp.jakarta.james.devel
Message-ID <[email protected]>
This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-jspf.git

commit 90006d742fb3c6cd27ce825ce830e7ee898fe18c
Author: Emerson Pinter <[email protected]>
AuthorDate: Wed Jan 22 14:44:59 2025 -0300

    Clear dnsjava cache before each test
---
 .../apache/james/jspf/AsynchronousSPFExecutorIntegrationTest.java  | 7 +++++++
 .../apache/james/jspf/SynchronousSPFExecutorIntegrationTest.java   | 7 +++++++
 2 files changed, 14 insertions(+)

diff --git a/resolver/src/test/java/org/apache/james/jspf/AsynchronousSPFExecutorIntegrationTest.java b/resolver/src/test/java/org/apache/james/jspf/AsynchronousSPFExecutorIntegrationTest.java
index e0f346b..64713b2 100644
--- a/resolver/src/test/java/org/apache/james/jspf/AsynchronousSPFExecutorIntegrationTest.java
+++ b/resolver/src/test/java/org/apache/james/jspf/AsynchronousSPFExecutorIntegrationTest.java
@@ -26,8 +26,10 @@ import org.apache.james.jspf.executor.SPFResult;
 import org.apache.james.jspf.impl.DNSServiceXBillImpl;
 import org.apache.james.jspf.impl.DefaultSPF;
 import org.apache.james.jspf.impl.SPF;
+import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
+import org.xbill.DNS.DClass;
 import org.xbill.DNS.Lookup;
 import org.xbill.DNS.Resolver;
 import org.xbill.DNS.SimpleResolver;
@@ -46,6 +48,11 @@ public class AsynchronousSPFExecutorIntegrationTest {
         }
     }
 
+    @Before
+    public void clearDnsCache() {
+        Lookup.getDefaultCache(DClass.IN).clearCache();
+    }
+
     @Test
     public void test() {
         SPF spf = DefaultSPF.createAsync();
diff --git a/resolver/src/test/java/org/apache/james/jspf/SynchronousSPFExecutorIntegrationTest.java b/resolver/src/test/java/org/apache/james/jspf/SynchronousSPFExecutorIntegrationTest.java
index db6ff9e..1ba354f 100644
--- a/resolver/src/test/java/org/apache/james/jspf/SynchronousSPFExecutorIntegrationTest.java
+++ b/resolver/src/test/java/org/apache/james/jspf/SynchronousSPFExecutorIntegrationTest.java
@@ -25,8 +25,10 @@ import org.apache.james.jspf.executor.SynchronousSPFExecutor;
 import org.apache.james.jspf.impl.DNSServiceXBillImpl;
 import org.apache.james.jspf.impl.DefaultSPF;
 import org.apache.james.jspf.impl.SPF;
+import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
+import org.xbill.DNS.DClass;
 import org.xbill.DNS.Lookup;
 import org.xbill.DNS.Resolver;
 import org.xbill.DNS.SimpleResolver;
@@ -47,6 +49,11 @@ public class SynchronousSPFExecutorIntegrationTest {
         }
     }
 
+    @Before
+    public void clearDnsCache() {
+        Lookup.getDefaultCache(DClass.IN).clearCache();
+    }
+
     @Test
     public void test() {
         SPF spf = DefaultSPF.createSync();
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.