24
24
package org .opengrok .indexer .history ;
25
25
26
26
import org .junit .jupiter .api .AfterEach ;
27
+ import org .junit .jupiter .api .BeforeEach ;
27
28
import org .junit .jupiter .api .Test ;
28
29
import org .opengrok .indexer .condition .EnabledForRepository ;
29
30
import org .opengrok .indexer .util .Executor ;
@@ -85,6 +86,11 @@ private void setUpTestRepository() throws IOException {
85
86
repository .create (getClass ().getResourceAsStream ("repositories.zip" ));
86
87
}
87
88
89
+ @ BeforeEach
90
+ public void setup () throws IOException {
91
+ setUpTestRepository ();
92
+ }
93
+
88
94
@ AfterEach
89
95
public void tearDown () {
90
96
if (repository != null ) {
@@ -95,7 +101,6 @@ public void tearDown() {
95
101
96
102
@ Test
97
103
public void testGetHistory () throws Exception {
98
- setUpTestRepository ();
99
104
File root = new File (repository .getSourceRoot (), "mercurial" );
100
105
MercurialRepository mr
101
106
= (MercurialRepository ) RepositoryFactory .getRepository (root );
@@ -114,7 +119,6 @@ public void testGetHistory() throws Exception {
114
119
115
120
@ Test
116
121
public void testGetHistorySubdir () throws Exception {
117
- setUpTestRepository ();
118
122
File root = new File (repository .getSourceRoot (), "mercurial" );
119
123
120
124
// Add a subdirectory with some history.
@@ -135,10 +139,8 @@ public void testGetHistorySubdir() throws Exception {
135
139
*/
136
140
@ Test
137
141
public void testGetHistoryPartial () throws Exception {
138
- setUpTestRepository ();
139
142
File root = new File (repository .getSourceRoot (), "mercurial" );
140
- MercurialRepository mr
141
- = (MercurialRepository ) RepositoryFactory .getRepository (root );
143
+ MercurialRepository mr = (MercurialRepository ) RepositoryFactory .getRepository (root );
142
144
// Get all but the oldest revision.
143
145
History hist = mr .getHistory (root , REVISIONS [REVISIONS .length - 1 ]);
144
146
List <HistoryEntry > entries = hist .getHistoryEntries ();
@@ -180,7 +182,6 @@ public static void runHgCommand(File reposRoot, String... args) {
180
182
*/
181
183
@ Test
182
184
public void testGetHistoryBranch () throws Exception {
183
- setUpTestRepository ();
184
185
File root = new File (repository .getSourceRoot (), "mercurial" );
185
186
186
187
// Branch the repo and add one changeset.
@@ -228,7 +229,6 @@ public void testGetHistoryBranch() throws Exception {
228
229
*/
229
230
@ Test
230
231
public void testGetHistoryGet () throws Exception {
231
- setUpTestRepository ();
232
232
File root = new File (repository .getSourceRoot (), "mercurial" );
233
233
MercurialRepository mr
234
234
= (MercurialRepository ) RepositoryFactory .getRepository (root );
@@ -260,7 +260,6 @@ public void testGetHistoryGet() throws Exception {
260
260
*/
261
261
@ Test
262
262
public void testgetHistoryGetForAll () throws Exception {
263
- setUpTestRepository ();
264
263
File root = new File (repository .getSourceRoot (), "mercurial" );
265
264
MercurialRepository mr
266
265
= (MercurialRepository ) RepositoryFactory .getRepository (root );
@@ -279,7 +278,6 @@ public void testgetHistoryGetForAll() throws Exception {
279
278
*/
280
279
@ Test
281
280
public void testGetHistoryGetRenamed () throws Exception {
282
- setUpTestRepository ();
283
281
File root = new File (repository .getSourceRoot (), "mercurial" );
284
282
MercurialRepository mr
285
283
= (MercurialRepository ) RepositoryFactory .getRepository (root );
@@ -306,7 +304,6 @@ public void testGetHistoryGetRenamed() throws Exception {
306
304
*/
307
305
@ Test
308
306
public void testGetHistoryWithNoSuchRevision () throws Exception {
309
- setUpTestRepository ();
310
307
File root = new File (repository .getSourceRoot (), "mercurial" );
311
308
MercurialRepository mr = (MercurialRepository ) RepositoryFactory .getRepository (root );
312
309
0 commit comments