File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
biojava-core/src/main/java/org/biojava/nbio/core/util
biojava-structure/src/test/java/org/biojava/nbio/structure Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -65,15 +65,15 @@ public class InputStreamProvider {
6565
6666 private boolean cacheRawFiles ;
6767
68- FlatFileCache cache ;
6968 public InputStreamProvider () {
7069 super ();
7170 cacheRawFiles = false ;
7271
7372 String prop = System .getProperty (CACHE_PROPERTY );
7473 if ( prop != null && prop .equals ("true" )) {
7574 cacheRawFiles = true ;
76- cache = FlatFileCache .getInstance ();
75+ // init the singleton
76+ FlatFileCache .getInstance ();
7777 }
7878
7979 }
Original file line number Diff line number Diff line change 2020 */
2121package org .biojava .nbio .structure ;
2222
23+ import org .biojava .nbio .core .util .FlatFileCache ;
2324import org .biojava .nbio .structure .io .mmcif .DownloadChemCompProvider ;
2425import org .biojava .nbio .structure .io .mmcif .model .ChemComp ;
2526import org .junit .Test ;
@@ -67,6 +68,10 @@ public void testRedirectWorks() {
6768 // just in case the we did get garbage, let's clean up
6869 file .delete ();
6970
71+ // very important: we have a memory cache of files, we need to reset it not to pollute the cache for later tests
72+ FlatFileCache ffc = FlatFileCache .getInstance ();
73+ ffc .clear ();
74+
7075 assertNotNull (cc );
7176
7277 assertNotNull (cc .getName ());
@@ -95,6 +100,10 @@ public void testWeDontCacheGarbage() {
95100
96101 file .delete ();
97102
103+ // very important: we have a memory cache of files, we need to reset it not to pollute the cache for later tests
104+ FlatFileCache ffc = FlatFileCache .getInstance ();
105+ ffc .clear ();
106+
98107 // we couldn't parse, thus there should be no content
99108 assertNull (cc .getName ());
100109
@@ -122,6 +131,10 @@ public void testIfWeCachedGarbageWeCanDetectIt() throws IOException {
122131
123132 file .delete ();
124133
134+ // very important: we have a memory cache of files, we need to reset it not to pollute the cache for later tests
135+ FlatFileCache ffc = FlatFileCache .getInstance ();
136+ ffc .clear ();
137+
125138 assertNull (cc .getName ());
126139
127140
You can’t perform that action at this time.
0 commit comments