Skip to content

Commit a82498f

Browse files
Lubos KoscoLubos Kosco
authored andcommitted
fix junit tests to not depend on sequence
1 parent c0e9038 commit a82498f

File tree

2 files changed

+23
-39
lines changed

2 files changed

+23
-39
lines changed

test/org/opensolaris/opengrok/history/HistoryGuruTest.java

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
*/
1919

2020
/*
21-
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
22-
* Use is subject to license terms.
21+
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
2322
*/
2423
package org.opensolaris.opengrok.history;
2524

@@ -46,7 +45,7 @@
4645
public class HistoryGuruTest {
4746

4847
private static TestRepository repository = new TestRepository();
49-
private static List<File> files = new ArrayList<File>();
48+
private static List<File> files = new ArrayList<>();
5049

5150
public HistoryGuruTest() {
5251
}
@@ -59,6 +58,19 @@ public static void setUpClass() throws Exception {
5958
FileUtilities.getAllFiles(new File(repository.getSourceRoot()),
6059
files, true);
6160
RuntimeEnvironment.getInstance().setVerbose(true);
61+
62+
HistoryGuru instance = HistoryGuru.getInstance();
63+
instance.addRepositories(repository.getSourceRoot());
64+
65+
instance.createCache();
66+
Collection<String> repos = new ArrayList<>();
67+
repos.add("git");
68+
repos.add("bazaar");
69+
repos.add("mercurial");
70+
repos.add("teamware");
71+
repos.add("rcs_test");
72+
repos.add("nonexistent");
73+
instance.createCache(repos);
6274
}
6375

6476
@AfterClass
@@ -79,26 +91,6 @@ public void testGetInstance() {
7991
assertNotNull(HistoryGuru.getInstance());
8092
}
8193

82-
@Test
83-
public void testAddRepositories() throws IOException {
84-
HistoryGuru instance = HistoryGuru.getInstance();
85-
instance.addRepositories(repository.getSourceRoot());
86-
}
87-
88-
@Test
89-
public void testCreateCache() {
90-
HistoryGuru instance = HistoryGuru.getInstance();
91-
instance.createCache();
92-
Collection<String> repos = new ArrayList<String>();
93-
repos.add("git");
94-
repos.add("bazaar");
95-
repos.add("mercurial");
96-
repos.add("teamware");
97-
repos.add("rcs_test");
98-
repos.add("nonexistent");
99-
instance.createCache(repos);
100-
}
101-
10294
@Test
10395
public void testUpdateRepositories() {
10496
HistoryGuru instance = HistoryGuru.getInstance();

test/org/opensolaris/opengrok/web/EftarFileTest.java

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
/*
21-
* Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
21+
* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
2222
*/
2323
package org.opensolaris.opengrok.web;
2424

@@ -65,6 +65,13 @@ public static void setUpClass() throws Exception {
6565
} finally {
6666
try { out.close(); } catch (Exception e) { }
6767
}
68+
//create eftar files
69+
String[] args = new String[2];
70+
args[0] = tsv.getAbsolutePath();
71+
args[1] = eftar.getAbsolutePath();
72+
73+
EftarFile ef = new EftarFile();
74+
ef.create(args);
6875
}
6976

7077
@AfterClass
@@ -86,21 +93,6 @@ public void setUp() throws Exception {
8693
public void tearDown() throws Exception {
8794
}
8895

89-
/**
90-
* Test creation of an EftarFile
91-
* @throws java.lang.Exception if an error occurs while creating the
92-
* eftar file
93-
*/
94-
@Test
95-
public void createEftarFile() throws Exception {
96-
String[] args = new String[2];
97-
args[0] = tsv.getAbsolutePath();
98-
args[1] = eftar.getAbsolutePath();
99-
100-
EftarFile ef = new EftarFile();
101-
ef.create(args);
102-
}
103-
10496
/**
10597
* Test usage of an EftarFile
10698
* @throws IOException if an error occurs while accessing the eftar file

0 commit comments

Comments
 (0)