2020
2121public class PreBagImplTest {
2222
23- BagFactory bagFactory = new BagFactory ();
24-
2523 @ Test
2624 public void testBagInPlaceWithExistingDataDir () throws Exception {
2725 File testDir = createTestBag (true );
2826 assertTrue (testDir .exists ());
2927 File testDataDir = new File (testDir , "data" );
3028 assertTrue (testDataDir .exists ());
31-
29+
30+ BagFactory bagFactory = new BagFactory ();
31+
3232 PreBag preBag = bagFactory .createPreBag (testDir );
3333 Bag bag = preBag .makeBagInPlace (BagFactory .LATEST , false );
3434 try {
@@ -45,7 +45,8 @@ public void testBagInPlaceRetainingBaseDir() throws Exception {
4545 assertTrue (testDir .exists ());
4646 File testDataDir = new File (testDir , "data" );
4747 assertFalse (testDataDir .exists ());
48-
48+
49+ BagFactory bagFactory = new BagFactory ();
4950 PreBag preBag = bagFactory .createPreBag (testDir );
5051 Bag bag = preBag .makeBagInPlace (BagFactory .LATEST , true );
5152 try {
@@ -65,7 +66,8 @@ public void testBagInPlaceNotRetainingBaseDir() throws Exception {
6566 assertTrue (testDir .exists ());
6667 File testDataDir = new File (testDir , "data" );
6768 assertFalse (testDataDir .exists ());
68-
69+
70+ BagFactory bagFactory = new BagFactory ();
6971 PreBag preBag = bagFactory .createPreBag (testDir );
7072 Bag bag = preBag .makeBagInPlace (BagFactory .LATEST , false );
7173 try {
@@ -93,6 +95,7 @@ public void testBagInPlaceWithIgnoredExtraDir() throws Exception {
9395 FileUtils .write (extraFile , "extra" );
9496 assertTrue (extraFile .exists ());
9597
98+ BagFactory bagFactory = new BagFactory ();
9699 PreBag preBag = bagFactory .createPreBag (testDir );
97100 List <String > ignoreDirs = new ArrayList <String >();
98101 ignoreDirs .add ("extra" );
@@ -128,6 +131,7 @@ public void testBagInPlaceWithDataDirAndTagDirPrev97() throws Exception {
128131 FileUtils .write (extraFile , "extra" );
129132 assertTrue (extraFile .exists ());
130133
134+ BagFactory bagFactory = new BagFactory ();
131135 PreBag preBag = bagFactory .createPreBag (testDir );
132136 preBag .makeBagInPlace (Version .V0_96 , false );
133137 }
@@ -146,6 +150,7 @@ public void testBagInPlaceWithDataDirAndTagDirPostv97() throws Exception {
146150 FileUtils .write (extraFile , "extra" );
147151 assertTrue (extraFile .exists ());
148152
153+ BagFactory bagFactory = new BagFactory ();
149154 PreBag preBag = bagFactory .createPreBag (testDir );
150155 Bag bag = preBag .makeBagInPlace (BagFactory .LATEST , false );
151156 try {
@@ -175,7 +180,8 @@ public void testBagInPlaceWithEmptyDir() throws Exception {
175180 assertTrue (emptyDir .exists ());
176181 File testDataDir = new File (testDir , "data" );
177182 assertFalse (testDataDir .exists ());
178-
183+
184+ BagFactory bagFactory = new BagFactory ();
179185 PreBag preBag = bagFactory .createPreBag (testDir );
180186 Bag bag = preBag .makeBagInPlace (BagFactory .LATEST , false );
181187 try {
@@ -198,7 +204,9 @@ public void testBagInPlaceKeepEmptyDirectories() throws Exception {
198204 File emptyDir = new File (testDir , "empty_dir" );
199205 FileUtils .forceMkdir (emptyDir );
200206 assertTrue (emptyDir .exists ());
201-
207+
208+ BagFactory bagFactory = new BagFactory (null );
209+
202210 PreBag preBag = bagFactory .createPreBag (testDir );
203211 Bag bag = preBag .makeBagInPlace (BagFactory .LATEST , true , true );
204212 try {
0 commit comments