summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
diff options
context:
space:
mode:
authorRobin Stocker <robin@nibor.org>2013-10-22 00:37:56 +0200
committerRobin Stocker <robin@nibor.org>2013-10-22 00:37:56 +0200
commit09711a4bb9f7fc07b8f8730f5bca3dbac16e909a (patch)
tree5173f116885c22043dd9a876d7561d5a3462046c /org.eclipse.jgit.test
parent057321731eb3495f56c762f344d584192bef0f98 (diff)
downloadjgit-09711a4bb9f7fc07b8f8730f5bca3dbac16e909a.tar.gz
jgit-09711a4bb9f7fc07b8f8730f5bca3dbac16e909a.zip
Make sure SystemReader is reset after test is run
Otherwise the MockSystemReader from the test setup is active for other tests. Change-Id: I7caf693bd692d06936e29efd4dc4aabb48c1c39b Signed-off-by: Robin Stocker <robin@nibor.org>
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java7
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/util/GitDateFormatterTest.java6
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/util/GitDateParserTest.java6
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RelativeDateFormatterTest.java6
4 files changed, 25 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java
index e5e1e7ad6e..6ebef6cbf9 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java
@@ -68,12 +68,19 @@ import org.eclipse.jgit.errors.ConfigInvalidException;
import org.eclipse.jgit.junit.MockSystemReader;
import org.eclipse.jgit.util.FS;
import org.eclipse.jgit.util.SystemReader;
+import org.junit.After;
import org.junit.Test;
/**
* Test reading of git config
*/
public class ConfigTest {
+
+ @After
+ public void tearDown() {
+ SystemReader.setInstance(null);
+ }
+
@Test
public void test001_ReadBareKey() throws ConfigInvalidException {
final Config c = parse("[foo]\nbar\n");
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/GitDateFormatterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/GitDateFormatterTest.java
index a818107f66..d52166f2ba 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/GitDateFormatterTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/GitDateFormatterTest.java
@@ -48,6 +48,7 @@ import static org.junit.Assert.assertEquals;
import org.eclipse.jgit.junit.MockSystemReader;
import org.eclipse.jgit.lib.PersonIdent;
import org.eclipse.jgit.util.GitDateFormatter.Format;
+import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -70,6 +71,11 @@ public class GitDateFormatterTest {
.parsePersonIdent("A U Thor <author@example.com> 1316560165 -0400");
}
+ @After
+ public void tearDown() {
+ SystemReader.setInstance(null);
+ }
+
@Test
public void DEFAULT() {
assertEquals("Tue Sep 20 19:09:25 2011 -0400", new GitDateFormatter(
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/GitDateParserTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/GitDateParserTest.java
index 6b0632aef0..570f4999dd 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/GitDateParserTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/GitDateParserTest.java
@@ -50,6 +50,7 @@ import java.util.Date;
import java.util.GregorianCalendar;
import org.eclipse.jgit.junit.MockSystemReader;
+import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -61,6 +62,11 @@ public class GitDateParserTest {
SystemReader.setInstance(mockSystemReader);
}
+ @After
+ public void tearDown() {
+ SystemReader.setInstance(null);
+ }
+
@Test
public void yesterday() throws ParseException {
GregorianCalendar cal = new GregorianCalendar(SystemReader
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RelativeDateFormatterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RelativeDateFormatterTest.java
index 0bf78f3900..2901c93885 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RelativeDateFormatterTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RelativeDateFormatterTest.java
@@ -53,6 +53,7 @@ import java.util.Date;
import org.eclipse.jgit.junit.MockSystemReader;
import org.eclipse.jgit.util.RelativeDateFormatter;
+import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -63,6 +64,11 @@ public class RelativeDateFormatterTest {
SystemReader.setInstance(new MockSystemReader());
}
+ @After
+ public void tearDown() {
+ SystemReader.setInstance(null);
+ }
+
private static void assertFormat(long ageFromNow, long timeUnit,
String expectedFormat) {
Date d = new Date(SystemReader.getInstance().getCurrentTime()